Beans with scriptlet
<%@ page import="com.rntsoft.Book" %>
<%
Book myBook = (Book) session.getAttribute("myBookBean");
if ( myBook == null)
{
myBook = new Book();
myBook.setAuthor("Joe");
session.setAttribute("myBookBean", myBook);
} // end of if ()
%>
JavaBean usage with scriptlets (1)
This page creates a JavaBean if you don't already have one.
Click here to go to a page that retrieves it.
//page2_scriptlet.jsp
<%@ page import="com.rntsoft.Book" %>
<%
Book myBook = (Book) session.getAttribute("myBookBean");
%>
JavaBean usage with scriptlets (2)
This page retrieves a JavaBean, and its properties.
JavaBean property | Value |
id | <%= myBookBean.getId() %> |
title | <%= myBookBean.getTitle() %> |
author | <%= myBookBean.getAuthor() %> |
price | <%= myBookBean.getPrice() %> |
///JavaBean usage - useBean and setProperty tags
JavaBean usage - useBean and setProperty tags
This page creates a JavaBean if you don't already have one.
Click
here to go to a page that retrieves it.
//useAndSet2.jsp
JavaBean usage - getProperty tag
This page retrieves a JavaBean, and its properties.
JavaBean property | Value |
id | |
title | |
author | |
price | |