HTML and CSS Reference
In-Depth Information
information for the next request is to use the
keep
keyword as follows:
#{flash.keep.attributeName}
. Listing 2-26
shows the modified
confirm.xhtml
page.
Listing 2-26.
The Modified confirm.xhtml Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="
http://www.w3.org/1999/xhtml
"
xmlns:ui="
http://java.sun.com/jsf/facelets
"
xmlns:h="
http://java.sun.com/jsf/html
"
>
<ui:composition template="/WEB-INF/templates/simple.xhtml">
<ui:define name="title">
#{bundle['survey.confirm.page']}
</ui:define>
<ui:define name="content">
<h:form>
<h:outputText value="#{bundle['survey.information.confirm']}"/>
<h:panelGrid columns="2">
<h:outputText value="#{bundle['survey.user.name']}"/>
<h:outputText value="#{flash.keep.userName}"/>
<h:outputText value="#{bundle['survey.user.age']}"/>
<h:outputText value="#{flash.keep.age}"/>
<h:outputText value="#{bundle['survey.user.sex']}"/>
<h:outputText value="#{flash.keep.sex}"/>
<h:outputText value="#{bundle['survey.user.monthyIncome']}"/>
<h:outputText value="#{flash.keep.monthlyIncome}"/>
<h:outputText value="#{bundle['survey.user.yearlyTravelAbroad']}"/>
<h:outputText value="#{flash.keep.travelsAbroad}"/>
<h:outputText value="#{bundle['survey.user.oftenTravelBy']}"></h:outputText>
<h:outputText value="#{flash.keep.travelBy}"/>
</h:panelGrid>
<h:commandButton value="#{bundle['survey.actions.save']}"
action="#{survey.save}"/>
<h:commandButton value="#{bundle['survey.actions.modify']}"
action="input?faces-redirect=true"/>
<br/><br/>
</h:form>
</ui:define>
</ui:composition>
</html>
Using the
#{flash.keep.attributeName}
will ensure keeping the flash attributes for the next request.