This page demonstrates a few important features that you will use in most of your JavaServer Faces applications. These features are described in the following subsections.
<HTML>
<HEAD> <title>Hello</title> </HEAD>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>// This tag library contains JavaServer Faces component tags for all UIComponent + HTML RenderKit Renderer combinations defined in the JavaServer Faces Specification
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> // The core JavaServer Faces custom actions that are independent of any particular RenderKit.
<body bgcolor="white">
<f:view> // Container for all JavaServer Faces core and custom component actions used on a page
// Renders an HTML "form" element.
<h:form id="helloForm" >
<h2>Hi. My name is Duke. I'm thinking of a number from
// value of the component should be rendered as text
<h:outputText value="#{UserNumberBean.minimum}"/> to
// value of the component should be rendered as text
<h:outputText value="#{UserNumberBean.maximum}"/>.
Can you guess it?</h2>
// Renders an HTML "img" element
<h:graphicImage id="waveImg" url="/wave.med.gif" />
// Renders an HTML "input" element of "type" "text".
<h:inputText id="userNo"
value="#{UserNumberBean.userNumber}">
// Register a LongRangeValidator instance on the UIComponent associated with the closest parent UIComponent custom action.
<f:validateLongRange
// Minimum value allowed for this component
minimum="#{UserNumberBean.minimum}"
// Maximum value allowed for this component
maximum="#{UserNumberBean.maximum}" />
// Renders an HTML "input" element of "type" "text".
</h:inputText>
// Renders an HTML "input" element.
// id = The component identifier for this component. This value must be unique within the closest parent component that is a naming container.
// action = MethodBinding representing the application action to invoke when this component is activated by the user. The expression must evaluate to a public method that takes no parameters, and returns a String (the logical outcome) which is passed to the NavigationHandler for this application.
<h:commandButton id="submit" action="success"
value="Submit" /> <p>
// Render a single message for a specific component.
Set-up for Rendering
Obtain the "summary" and "detail" properties fromUIMessage component. If not present, keep the empty string as the value, respectively. Obtain the firstFacesMessage to render from the component, using the "for" property of the UIMessage. This will be the only message we render. Obtain the severity style for this message. If the severity of the message isFacesMessage.SEVERITY_INFO, the severity style comes from the value of the "infoStyle" attribute. If the severity of the message isFacesMessage.SEVERITY_WARN, the severity style comes from the value of the "warnStyle" attribute, and so on for each of the severities, INFO, WARN, ERROR andFATAL. The same rules apply for obtaining the severity style class, but instead of "infoStyle, warnStyle", etc use "infoClass, warnClass", etc. Obtain the "style", "styleClass" and "layout" attributes from theUIMessage component. If we have a "style" attribute and a severity style attribute, use the severity style attribute as the value of the "style" attribute. If we have no "style" attribute, but do have a severity style, use the severity style as the value of the "style" attribute. The same precedence rules apply for the style class.
Rendering
For the message renderer, we only render one row, for the first message. For the messages renderer, we render as many rows as we have messages. If either of the "style" or "styleClass" attributes has a non-null value (as determined above), render a "span" element, outputting the value of the "style" attribute as the the value of the "style" attribute, and outputting the value of the "styleClass" attribute as the value of the "class" attribute on the "span" element. If theUIMessage has a "tooltip" attribute with the value of "true", and the UIMessage has "showSummary" and "showDetail" properties with the value "true", if we haven't already written out the "span", output the "summary" as the value of the "title" attribute on the "span". If we haven't already written out a "title" attribute, and "showSummary" is true, output the summary. If "showDetail" is true, output the detail. Close out the span if necessary.
<h:message style="color: red;
font-family: 'New Century Schoolbook', serif;
font-style: oblique;
text-decoration: overline"
id="errors1"
for="userNo"/>
</h:form>
</f:view>
</HTML>
Monday, April 25, 2005
Subscribe to:
Post Comments (Atom)
Popular Posts
- Yahoo! Mail: Revenge of the Oddpost
- Linux Forum: Apache, Webmin and Mandrake - Linux Operating System Help
- Free AS400 & iSeries Software Tools & Utilities Downloads
- UDATE and *DATE in AS400 RPG
- Recover or reset QSECOFR passwords
- iReport - OpenSource Java Reporting Tool
- Basic Requirements of a JavaServer Faces Application
- Creating an as400 Query
- AS400 APIs
- Fast-track your Web apps with Ruby on Rails
No comments:
Post a Comment