Java Reference
In-Depth Information
xmlns:a4j=" http://RichFaces.org/a4j"
xmlns:c=" http://java.sun.com/jstl/core">
<head>
<title>Album details</title>
</head>
<body>
<h:form id="view_details">
<b>Details for album '#{albumDetailsBean.album.name}':</b>
<table border='1'>
<tr><td>
<table>
<tr><td>Title: #{albumDetailsBean.album.name}</td></tr>
<tr><td>Year: #{albumDetailsBean.album.year}</td></tr>
<tr><td>Style: #{albumDetailsBean.album.style}</td></tr>
<tr><td>Author: #{albumDetailsBean.album.author}</td></tr>
<tr><td>Price: $ #{albumDetailsBean.album.price}</td></tr>
<tr><td>
<rich:panel bodyClass="rich-laguna-panel-no-header">
<a4j:commandButton id="PurchaseButton"
value="Purchase" reRender="rep"
action="#{albumDetailsBean.purchase}">
<a4j:actionparam id="status" name="status"
value="Successfully purchased:
#{albumDetailsBean.album.name}"
assignTo="#{albumDetailsBean.status}"/>
</a4j:commandButton>
<rich:spacer width="20" />
<a4j:commandButton value="Cancel" reRender="rep"
action="#{albumDetailsBean.cancel}"/>
</rich:panel>
<rich:spacer height="1" />
<rich:panel bodyClass="rich-laguna-panel-no-header">
<h:outputText id="rep" name="rep"
value="#{albumDetailsBean.status}" />
</rich:panel>
</td></tr>
</table>
</td>
<td><img src="#{albumDetailsBean.album.imageURL}"/></td></tr>
</table>
</h:form>
</body>
</html>
This JSP is implemented using the RichFaces tag libraries. This JSP lists all details
for the selected album B . We have two button declarations: the Purchase button
C and the Cancel button D . We use RichFaces components to declare these but-
tons and to implement Ajax behavior. Notice the reRender attribute in the defini-
tion: this attribute holds the ID of another component that needs to be rerendered
when we get the response from the server. In our case, the rerendered component
is a text component that displays the status of the purchase E .
B
C
D
E
 
 
Search WWH ::




Custom Search