j2ee_-_jsf_-_mastering_java_server_faces_-_wiley_-_2004

Page 271

244

Chapter 7

or a string that won’t be matched by an existing navigation rule, though returning null is probably clearer and less likely to result in bugs later on if the navigation rules are changed.

Initializing the Next Page The primary responsibility of the ViewInvoicesPage class’s modifyInvoice() method (Listing 7.9) is to return the outcome needed to navigate to the Modify Invoice page, which will be rendered by ModifyInvoice.jsp as shown in Listing 7.8. <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1”> <title>Chaper 7, Example 1</title> <link rel=”stylesheet” href=”/ch7ex1/styles.css” type=”text/css”> <%@ taglib uri=”http://java.sun.com/jsf/html” prefix=”h” %> <%@ taglib uri=”http://java.sun.com/jsf/core” prefix=”f” %> </head> <body> <f:view> <f:subview id=”header”/> <jsp:include page=”Header.jsp” flush=”true”> <jsp:param name=”pageName” value=”Modify Invoice”/> <jsp:param name=”linkUrl” value=”ViewInvoices.jsp”/> <jsp:param name=”linkText” value=”Back to List”/> </jsp:include> </f:subview> <p> <h:messages styleClass=”ErrorMessage”/> <h:form id=”invoiceForm”> <h:panelGrid id=”invoicePanel” columns=”2” columnClasses=”FieldLabel,TextInput” footerClass=”TableCellRight”> <h:outputText id=”invoiceNumberLabel” value=”Invoice Number”/> <h:inputText id=”invoiceNumber” styleClass=”TextInput” required=”true” value=”#{modifyInvoicePage.invoice.invoiceNumber}”> <f:validateLongRange minimum=”1000”/> </h:inputText>

Listing 7.8 ModifyInvoice.jsp.


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.