|
JSP with JSF Custom Tags
Listing 1. In this simple JSP page with JSF custom tags (which appear in bold), the code defines several components. Figure 3 shows you the output.
<%@ taglib uri="http://java.sun.com/jsf/core"
prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"
prefix="h" %>
<f:use_faces>
<html>
<head>
<title>
<h:output_text id="titleOutput"
value="JSF in Action - Hello, world!"/>
</title>
</head>
<body>
<h:form id="welcomeForm" formName="welcomeForm">
<font face="Arial, sans-serif" size="+2">
<h:output_text id="welcomeOutput"
value="Thanks, and have a pleasant day!/>
</font>
<p>
<h:output_errors id="errors" for="helloInput"/>
</p>
<p>
<h:output_text id="helloInputLabel" value=
"Enter some text:"/>
<h:input_text id="helloInput" valueRef=
"helloBean.value"/>
</p>
<p>
<h:output_text id="helloBeanOutputLabel"
value="Current JavaBean value:"/>
<h:output_text id="helloBeanOutput" valueRef=
"helloBean.value"/>
</p>
<h:command_button id="redisplayCommand" type=
"submit"
label="Redisplay"
commandName="thanks"
actionRef="helloBean.thanksAction"/>
<h:command_button id="goodbyeCommand" type=
"submit" label="Goodbye"
commandName="quit"
action="goodbye"/>
</h:form>
</body>
</html>
</f:use_faces>
|