|
MyEclipse 下开发JSF教程(9) Book bean </description> <managed-bean-name>bookBean</managed-bean-name> <managed-bean-class>de.laliluna.tutorial.library.Book</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>
<managed-bean> <description> BookList Bean </description> <managed-bean-name>bookListBean</managed-bean-name> <managed-bean-class>de.laliluna.tutorial.library.BookList</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>
<managed-bean> Define a managed bean <managed-bean-name>bookBean</managed-bean-name> Define a name for the managed bean. This name is used in the JSP file. <managed-bean-class>de.laliluna.tutorial.library.Book</managed-bean-class> Define the class which represent the bean. <managed-bean-scope>request</managed-bean-scope> Define in which scope the bean is saved. Create the JSP filesIn the first step we create a JSP file named index.jsp, which forwards the user to the list of books. index.jsp<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <jsp:forward page="/listBooks.faces" /> </body> </html>
In the second step we create the book overview. listBooks.jsp<%@ page language="Java" %> <%@ taglib uri="http://Java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://Java.sun.com/jsf/core" prefix="f" %>
|