JavaServer Faces User's Guide J2X ENZ2(00)
|
|
- Polly Rose
- 6 years ago
- Views:
Transcription
1 JavaServer Faces User's Guide J2X ENZ2(00)
2 Preface Purpose This manual explains how to design and develop business applications when JavaServer Faces is applied to Web application development. Readers can get an understanding of the configuration and development of JavaServer Faces applications. Intended Readers This manual is intended for application designers and those who implement applications. Readers are assumed to have knowledge of the following: Creating applications using servlets and JSPs Organization of This Manual The manual has the following sections: Overview of JavaServer Faces This section explains features of JavaServer Faces applications. JavaServer Faces Functions This section explains functions of JavaServer Faces. Development Using JavaServer Faces Tags This section explains how to develop applications by using the standard tags provided by JavaServer Faces. Development Using UJI Tags This section explains how to use UJI tags in JavaServer Faces applications. Using Apcoordinator Functions This section explains how to use Apcoordinator functions in JavaServer Faces applications. Related Manuals Read also the following manuals as necessary: JavaServer Faces API Reference For details on JavaServer Faces Java classes and Java interfaces, refer to this manual. JavaServer Faces Definition File Reference For details on coding of the JavaServer Faces definition file (faces-config.xml), refer to this manual. JavaServer Faces Tag Reference For details of the standard tags provided by JavaServer Faces, refer to this manual. Apcoordinator User's Guide For details on each function of Apcoordinator, refer to this manual. UJI Tag Reference For details of UJI tags, refer to this manual. i
3 ii
4 Contents Chapter 1 Overview of JavaServer Faces JavaServer Faces... 1 Chapter 2 JavaServer Faces Functions JavaServer Faces Applications and Lifecycle Input-Output Pages and UIComponents Managed Beans Value Binding Expression and Method Binding Expression Event Processing Page Transitions Validators Converters... 9 Chapter 3 Development of JavaServer Faces Applications Creating a Managed Bean Creating an Input-Output Page Creating an Event Listener Creating a Validator Creating a Converter Creating a Page Transition Definition Displaying Messages Character Encoding Chapter 4 Development Using JavaServer Faces Tags...27 Chapter 5 Development Using UJI Tags Available UJI Tags Referring to the Properties of Managed Beans Using Validators Using Converters Using Events Using action methods Using valuechangelistener...38 Chapter 6 Using Apcoordinator Functions Binary File Send/Receive Function Uploading files Downloading files Application Log Function EJB and Web Service Invocation Function Chapter 7 Setting Up the Runtime Environment Runtime File Mapping iii
5 7.2 Files Required for Execution Web Application Environment Definition File (web.xml) Appendix A UIComponents Corresponding to UJI Tags...51 A.1 UIComponent Specifications A.2 UIComponent Class Diagrams...53 Terms...61 iv
6 Chapter 1 Overview of JavaServer Faces 1.1 JavaServer Faces JavaServer Faces is a set of specifications drawn up as JSR-127 by the Java Community Process (JCP). It is an application framework for creating Web application user interfaces. JavaServer Faces has the following features: User interfaces (UIs) developed with JavaServer Faces in a development environment can be used to develop Web applications through a GUI. JavaServer Faces supports an "event model" that implements processing on a server at the time that an event that occurred on a client is received. Original UIs can be developed using the JavaServer Faces framework. The figure below shows an outline of an application using JavaServer Faces. As shown in the above figure, a JavaServer Faces application consists of the following components: JSP A JSP page can use Apcoordinator UJI tags and JavaServer Faces tags. It defines event processing for buttons on the page and for changes in input data. For each event, the JavaServer Faces runtime engine invokes the corresponding event listener or Java class method. Managed bean Bean for storing page values faces-config.xml File with definitions of the JavaServer Faces environment. The environment that is defined includes page transitions, events to be invoked, and beans to be used. Validator, value change listener, and action listener Processing components that are individually invoked when an applicable request is received from a client The following sections explain how to develop the components, including a JSP page, managed beans, and faces-config.xml. 1
7 2
8 Chapter 2 JavaServer Faces Functions 2.1 JavaServer Faces Applications and Lifecycle As with general Java Web applications, JavaServer Faces applications run on servlet containers by using JSP, Java Beans, and event listeners. One of the unique functions of JavaServer Faces is the capability to use built-in and user-created UIComponents, event handlers, validators, and converters defined in an external environment definition file (faces-config.xml). This enables UI and event processing logic to be corrected separately, thereby improving productivity in fixing and adding new functions to an application. The lifecycle of a JavaServer Faces application is explained below. The lifecycle means the processing flow from the time that the JavaServer Faces application receives a request until it returns a response. JavaServer Faces processes a request in the following processing flow: The six phases indicated by solid arrows are processed sequentially unless a validation or conversion error occurs or event processing occurs. The dotted lines indicate error processing. Restore View phase The Restore View phase begins when a request is sent to a server by the clicking of a link or button. In this phase, JavaServer Faces creates a UIComponent tree for an input-output page and associates event processing and validators with the UIComponents. The created tree is saved to the FacesContext instance. Apply Request Values phase After UIComponents are created in the Restore View phase, the Apply Request Values phase begins to acquire and apply the values of a sent form. If value acquisition or application fails, an error message is set in the FacesContext instance, and the phase changes to the Render Response phase. Process Validations phase In this phase, all validators associated with the page to be displayed are processed. If any value is invalid, an error message is set in the FacesContext instance, and the phase changes to the Render Response phase. Update Model Values phase In this phase, the values of the associated model are updated after the values are checked for validity. If 3
9 updating of the model fails, an error message is set in the FacesContext instance, and the phase changes to the Render Response phase. Invoke Application phase In this phase, application level events such as page transitions are processed. If an error occurs, an error message is set in the FacesContext instance, and the phase changes to the Render Response phase. Render Response phase In this phase, a UIComponent tree is returned as a response in a format (e.g., HTML) that can be rendered by the client. 2.2 Input-Output Pages and UIComponents JavaServer Faces composes a page by combining UIComponents.UIComponents are components such as forms, text fields, and buttons that make up a page.the corresponding JSP extension tags are provided for individual UIComponents so that a page can be created with JSP extension tags written in a JSP file. To display a UIComponent text field, for example, write the h:inputtext tag in the JSP file. The JSP file used to create a page is called an input-output page. The standard JSP extension tags provided by JavaServer Faces are classified into two types: tags in the JavaServer Faces component tag library and tags in the JavaServer Faces basic tag library.the component tags are the tags of user interface components such as text fields and command buttons. The basic tags include the f:view tag that encloses all the JavaServer Faces tags and the tags in which event listeners are set. Thus, the basic tags specify the configuration and operation of applications and pages.these tag libraries can be used in the same way as ordinary custom libraries. This product provides a tag library called UJI tags in addition to the standard tags provided by JavaServer Faces. For details on UJI tags, refer to "Development Using UJI Tags". A coding example of an input-output page is shown below.as indicated by comments, the example assigns a value, specifies a validator, and specifies event processing. <HTML> <HEAD> <TITLE>Sample1</TITLE> </HEAD> <!-- Declares use of the JavaServer Faces tag library. --> <%@ taglib uri=" prefix="h" %> <%@ taglib uri=" prefix="f" %> <BODY> <!-- Writes JavaServer Faces UIComponent tags in f:view. --> <f:view> <H2>Sample</H2> <h:form> <!-- Assigns a value to the mybean userid property. --> <h:inputtext value="#{mybean.userid" > <!-- Specifies the maximum number of characters with a validator. --> <f:validatelength maximum="10"/> </h:inputtext> <!-- Invokes the mybean doanyaction method when the button is clicked. --> 4
10 <h:commandbutton action="#{mybean.doanyaction" value="go"/> </h:form> </f:view> </BODY> </HTML> The UIComponents in the above coding are converted into HTML by the renderer prepared in advance, and the resulting display is as shown below. UIComponents and renderers used to display UIComponents are designed separately in JavaServer Faces.Accordingly, simply changing renderers enables UIComponents to be displayed in different modes.renderers are created so that they display UIComponents in the appropriate formats for individual clients.in JavaServer Faces, Renderers that display UIComponent in HTML are prepared in advance. For details on how to create input-output pages, refer to "Creating an Input-Output Page". 2.3 Managed Beans Normally, JavaServer Faces applications store values to be displayed and data to be sent, while associating managed bean properties with UIComponents.Managed beans can define event processing, validation, and methods for page transitions. To assign a managed bean value or an event processing method to a UIComponent, specify the managed bean property or method using the value binding expression or the method binding expression written in #{.An example of mapping with an input-output page is shown below. [Example of using managed beans from an input-output page] <!-- Specify a property for value and a method for validator. --> <h:inputtext id="empno" value="#{employeebean.usernumber" validator="#{employeebean.validatenumber" /> The procedure for using managed beans is as follows: 1. Create a Bean class. 2. Define the created Bean as a managed bean in the JavaServer Faces definition file (faces-config.xml). 3. Specify the property names and method names assigned to UIComponents on an input-output page. For details on how to create and use managed beans, refer to "Creating a Managed Bean". 2.4 Value Binding Expression and Method Binding Expression This section explains the value binding expression and the method binding expression. The value binding expression is a notation method for associating a page with a property of a managed bean. The method binding expression is a notation method for associating a page with a method of a managed bean. Both expressions are mostly used for tag attributes. As in "#{mybean.myprop", the value binding expression and the method binding expression must begin with "#{" and end with "". 5
11 Value binding expression Write a managed bean identifier and property name by concatenating them with "." (dot) in "#{ ". If beans are nested, as many beans as the number of nested beans can be concatenated using "." A sample JSP page is shown below. <f:view> <!-- Displaying the myprop property of the managed bean, which is defined with the name mybean --> <h:outputtext value="#{mybean.myprop" /> <!-- Displaying the myprop property of mybean3, while mybean1, mybean2, and mybean3 are nested --> <h:outputtext value="#{mybean1.mybean2.mybean3.myprop" /> </f:view> If the property is an array, java.util.list, java.util.map, refer to the value by using "[]". <f:view> <!-- If the myarray property is an array, display the 0th element of the array. --> <h:outputtext value="#{mybean.myarray[0]" /> <!-- If the mylist property is of the java.util.list type, display the 3rd element of the list. --> <h:outputtext value="#{mybean.mylist[3]" /> <!-- If the mymap property is of the java.util.map type, display the value corresponding to "mykey". --> <h:outputtext value="#{mybean.mymap['mykey']" /> </f:view> Method binding expression Write a managed bean identifier and method name by concatenating them with "." (dot) in "#{ ". As with referencing of values, if beans are nested, as many beans as the number of nested beans can be concatenated using "." A sample JSP page is shown below. <f:view> <h:form> <!-- Use the validate method of the managed bean defined with the name mybean to verify the value. --> <h:inputtext value="#{mybean.myprop" validator="#{mybean.validate" /> </h:form> </f:view> 6
12 Reserved variables The following reserved variables can be used in value binding expressions and method binding expressions. Variable name Type Explanation applicationscop e cookie facescontext header headervalues initparam param paramvalues java.util.map java.util.map javax.faces.context.facesconte xt java.util.map java.util.map java.util.map java.util.map java.util.map Collection of all application scope variables Collection of cookies in a request. The Map key is a cookie name, and the value is the javax.servlet.http.cookie instance. javax.faces.context.facescon text class instance Collection of all request headers. Individual values in Map are of the java.lang.string type. Collection of all request headers. Individual values are arrays of the java.lang.string type. Collection of application initialization parameters Collection of request parameters. The value of the first request parameter of those corresponding to individual keys is stored. Collection of request parameters. The request parameter corresponding to each key is stored in the java.lang.string array. requestscope sessionscope view java.util.map java.util.map javax.faces.component.uiviewro ot An example of use of a reserved variable is shown below. Collection of all request scope variables Collection of all session scope variables javax.faces.component.uiview Root class instance corresponding to the page being displayed <f:view> <!-- Display for the request parameter corresponding to key "paramkey" --> <h:outputtext value="#{param['paramkey']" /> </f:view> 2.5 Event Processing JavaServer Faces applications handle three types of events: ActionEvent, ValueChangeEvent, and PhaseEvent. An event listener model of JavaServer Faces receives an event class using the listener interface and processes events occurring in UIComponents. 7
13 JavaServer Faces supports the following three types of events: ActionEvent occurs at such times as when the user clicks a button or hyperlink component.this event occurs in the Invoke Application or Apply Request Values phase. ValueChangeEvent occurs when the user changes the value of a UIComponent. This event does not occur at the time that a validation error is detected.this event occurs in the Process Validations or Apply Request Values phase. PhaseEvent can perform processing by causing an interrupt before or after a JavaServer Faces lifecycle phase.this event can be used for unified preprocessing and postprocessing of a business logic. Applications can process these events as follows: The application creates an event listener and assigns it to a UIComponent by using the f:valuechangelistener tag or f:actionlistener tag on an input-output page.in the case of the PhaseEvent listener, the application defines it in the JavaServer Faces definition file (faces-config.xml). The application uses the managed bean method to create event processing and specifies the method-binding expression in the appropriate attribute of a UIComponent. For details on how to create and invoke individual events, refer to "Creating an Event Listener". 2.6 Page Transitions Generally, each Web application, such as a JavaServer Faces application, consists of multiple input-output pages.therefore, transitions between the pages must be defined and implemented when an application is created. JavaServer Faces applications can easily define page transitions and which transition is executed according to event processing.page transition is a series of rules to select the transition destination page when the user clicks a button or hyperlink.define these rules by using the navigation-rule tag in the JavaServer Faces definition file (faces-config.xml) written in XML.Write transition source names, action results, and transition destination page names for the rules. A coding example is shown below. [Coding example of the JavaServer Faces definition file (faces-config.xml)] <faces-config>... <navigation-rule> <!-- Write the transition source JSP name. --> <from-view-id>/input.jsp</from-view-id> <!-- Change the transition destination according to the action result. --> <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/result.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>fail</from-outcome> <to-view-id>/input.jsp</to-view-id> </navigation-case> </navigation-rule>... </faces-config> 8
14 The following methods can be used to specify rules for selections according to the type of user operation: Specify the character string showing the action result for the value of the action attribute of a UIComponent. Specify the method that returns the action result by using the method binding expression as the value of the action attribute of a UIComponent. For details on each method, refer to "Creating a Page Transition Definition". 2.7 Validators JavaServer Faces supports a method for verifying data in UIComponents such as text fields in which users can enter data.data in a UIComponent is verified before updated data is set in properties of the managed bean allocated to the UIComponent. If verification fails, properties of the managed bean are not updated. JavaServer Faces defines the classes of a series of validators that implement standard data checks. In addition, it provides basic tags corresponding to the standard validators. Developers of input-output pages can register validators in UIComponents. The standard validators provided by JavaServer Faces are available. In addition, custom validators can be created and used. The procedure for using a validator is as follows: 1. Decide the validator to be used. - Use a standard validator if it satisfies the function requirements. - Otherwise, create and use a custom validator. 2. When using a custom validator, define it in the JavaServer Faces definition file (faces-config.xml). 3. Register the validator in a UIComponent on an input-output page. For details on the following points of validator development, refer to "Creating a Validator": Standard validators provided by JavaServer Faces Creating and registering a custom validator Specifying a validator on an input-output page 2.8 Converters When UIComponents are assigned to Bean properties, the data handled by JavaServer Faces is represented in the following two formats: Format in which data is represented in data types, such as int and long, within a model Format in which data is represented in such a way that users can read, enter, and correct it When a value on an input-output page is updated or when a Bean data value is changed by event processing, conversion processing between the two formats is performed.data is automatically converted in standard mode unless otherwise specified. However, data may need to be converted to a specified format other than the standard format.for this reason, JavaServer Faces enables converters to be registered in UIComponents.The converters provided by JavaServer Faces can be used as well as custom converters created by users. The procedure for using a converter is as follows: 1. Decide the converter to be used. - Use a standard converter if it satisfies the requirements. - Otherwise, create and use a custom converter. 2. Register the converter in a UIComponent on an input-output page. For details on the following points of converter development, refer to "Creating a Converter": Standard converters provided by JavaServer Faces Creating a custom converter Specifying a converter on an input-output page 9
15 10
16 Chapter 3 Development of JavaServer Faces Applications This section explains a standard development method using JavaServer Faces. An event model application has the following basic components: Managed bean (model) Input-output page (JSP) Event listener (business logic) Validator Converter Page transition definition (XML) Subsequent sections explain how to create these components. 3.1 Creating a Managed Bean Create a Bean for storing values to be displayed or data to be sent. The Bean has values in its properties, and it also has accessor methods (Setter and Getter). In addition, it can implement event listeners. For details, refer to "Creating an Input-Output Page". Registering the Bean as a managed bean enables the following types of operations through an input-output page: Allocating input and output data to Bean properties Allocating an input data validator to a Bean method Allocating UIComponent event processing to a Bean method In the following example, a listener that operates when a value is updated and a listener that operates when a button is clicked are implemented. package mypkg; import javax.faces.event.actionevent; import javax.faces.event.valuechangeevent; public class MyBean { protected String message = "My Message"; public String getmessage() { return this.message; public void setmessage(string message) { this.message = message; public String getidfornextpage() { // Acquires a value for a page transition. return "success"; 11
17 public void messagechanged(valuechangeevent event) { // Coding of the processing executed at the time that the message property value is updated public void pushed(actionevent e) { // Coding of the processing executed at the time that an associated button is clicked Specify the name and scope of the created model in the JavaServer Faces definition file (faces-config.xml). In the following example, the mypkg.mybean class is registered with the name mybean, and the scope is session. <faces-config> <managed-bean> <managed-bean-name>mybean</managed-bean-name> <managed-bean-class>mypkg.mybean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config> Specify the scope by selecting none, application, session, or request.if no scope is specified, none is assumed, and the Bean is not saved to any scope, i.e., the Bean exists only while it is referenced. 3.2 Creating an Input-Output Page To use JavaServer Faces UIComponents on a JSP page, use the JavaServer Faces component tag library and JavaServer Faces basic tag library.the component tags are user interface component tags. The basic tags specify application and page structures and operations.these tag libraries can be used in the same way as general custom tag libraries. To use these tags on an input-output page, the beginning of the page must have a declaration as shown below. <%@ taglib uri=" prefix="h" %> <%@ taglib uri=" prefix="f" %> The uri attribute identifies a tag library. The prefix attribute identifies the tag library to which a tag belongs.the above example specifies that a component tag be preceded by h: and that a basic tag be preceded by f:. The JavaServer Faces tags represent a tree of UIComponents. The root of the tree is the UIViewRoot component, which is represented by the f:view tag. <f:view> Other JavaServer Faces tags </f:view> HTML and JSP tags can be written outside the f:view tags, but JavaServer Faces tags must be written within 12
18 the scope enclosed by the f:view tags. And, f:view corresponding to one screen is only one. For details on the standard tags provided by JavaServer Faces and the display resulting from each tag, refer to "Development Using JavaServer Faces Tags". Using value binding expressions and method binding expressions, UIComponent tags can allocate Bean properties to UIComponents and specify event processing, validators, and converters for them. An example is shown below. Note that the example provides comments with <!-- --> for explanations, but no comment can actually be written between the < and > of a tag. <f:view> <h:form> <h:inputtext <!-- Assigns the mybean message property value to the h:inputtext value attribute. --> value="#{mybean.message" <!-- Invokes the messagechanged method of mybean when the value is changed. --> valuechangelistener="#{mybean.messagechanged" > <!-- Specifies the maximum number of characters with a validator. --> <f:validatelength maximum="10"/> </h:inputtext> <h:commandbutton <!-- Invokes the getidfornextpage of mybean when the send button is clicked. The resulting page transition is based on the return value. --> action="#{mybean.getidfornextpage" value="send" <!-- Invokes the pushed method of mybean when the send button is clicked. --> actionlistener="#{mybean.pushed" /> </h:form> </f:view> For details on how to specify the following processing definitions, refer to the respective sections indicated next to them: Event listener - Creating an Event Listener Converter - Creating a Converter Validator - Creating a Validator Page transition - Creating a Page Transition Definition 3.3 Creating an Event Listener There are three types of events: ActionEvent, ValueChangeEvent, and PhaseEvent. ActionEvent The ActionEvent event occurs in a UIComponent that implements the javax.faces.component.actionsource interface.this event occurs when an anchor or button is clicked.to use ActionEvent, use one of the following procedures: Specify the managed bean method by writing a method binding expression in the actionlistener attribute of the UIComponent tag. The argument to the specified method must be an instance of the 13
19 javax.faces.event.actionevent class, and the return value must be void. The specified method is invoked when ActionEvent occurs. Create a class that implements the javax.faces.event.actionlistener interface. Write the f:actionlistener tags within the UIComponent tags, specifying the implementation class of ActionListener. The processaction method of ActionListener is invoked when ActionEvent occurs. Examples of use of the actionlistener attribute are shown below. [JSP coding example] <h:commandbutton value="send" actionlistener="#{mybean.pushed" /> [Event listener coding example] import javax.faces.event.actionevent; public class MyBean { public void pushed(actionevent event) { // Coding of processing ValueChangeEvent This event occurs in the UIComponent that implements the javax.faces.component.editablevalueholder interface.it occurs when the value of a tag (e.g., field, combo box) having an input value is changed.to use ValueChangeEvent, use one of the following procedures: Specify the managed bean method by writing a method binding expression in the valuechangelistener attribute of the UIComponent tag. The argument to the specified method must be an instance of the javax.faces.event.valuechangeevent class, and the return value must be void. The specified method is invoked when ValueChangeEvent occurs. Create a class that implements the javax.faces.event.valuechangelistener interface. Write the f:valuechangelistener tags within the UIComponent tags, specifying the implementation class of ValueChangeListener. The processvaluechange method of ValueChangeListener is invoked when ValueChangeEvent occurs. Note that ValueChangeEvent occurs not at the moment a value on the page is changed but at the moment the request issued by the clicking of a button is sent to a server. Examples of use of the f:valuechangelistener tag are shown below. [JSP coding example] <h:inputtext value="#{mybean.message" > <f:valuechangelistener type="mypkg.listeners.inputtextlistener" /> </h:inputtext> 14
20 [Event listener coding example] package mypkg.listeners; import javax.faces.event.valuechangeevent; public class InputTextListener implements javax.faces.event.valuechangelistener { public void processvaluechange(valuechangeevent event) { // Coding of processing PhaseEvent A PhaseEvent listener can be used for processing by causing an interrupt before or after a JavaServer Faces phase. This event listener can be used for unified preprocessing and postprocessing of business logic.examples of use are shown below. [Event listener coding example] import javax.faces.event.phaseid; public class MyFacesListener implements javax.faces.event.phaselistener{ public void beforephase(javax.faces.event.phaseevent event){ // Coding of preprocessing public void afterphase(javax.faces.event.phaseevent event){ // Coding of postprocessing public PhaseId getphaseid(){ // Specifies the interrupt phase. return PhaseId.INVOKE_APPLICATION; [Definitions in the JavaServer Faces definition file (faces-config.xml)] <faces-config> 15
21 ... <lifecycle> <phase-listener>mypkg.myfaceslistener</phase-listener> </lifecycle>... </faces-config> In the event coding example, the following can be specified for the return value of the getphaseid method. javax.faces.event.phaseid.any_phase javax.faces.event.phaseid.restore_view javax.faces.event.phaseid.apply_request_values javax.faces.event.phaseid.process_validations javax.faces.event.phaseid.update_model_values javax.faces.event.phaseid.invoke_application javax.faces.event.phaseid.render_response 3.4 Creating a Validator Interrupts any phase. Interrupts the Restore View phase. Interrupts the Apply Request Values phase. Interrupts the Process Validations phase. Interrupts the Update Model Values phase. Interrupts the Invoke Application phase. Interrupts the Render Response phase. As many validators as desired can be specified for the UIComponent that implements the javax.faces.component.editablevalueholder interface. Validators can be used in three modes: use of standard validators that have already been prepared, use of method-binding, or use of custom validators created by users. Standard validators The following three standard validators are available: LengthValidator This validator checks the length of value that is entered. It can check the minimum and maximum values of the length. <f:validatelength minimum="5" maximum="9" /> DoubleRangeValidator This validator checks whether a numeric value that has been entered is within the specified range. It can check the maximum and minimum values. The specifiable value is the range of Double. <f:validatedoublerange minimum="10.00" maximum="999.99" /> LongRangeValidator This validator checks whether a numeric value that has been entered is within the specified range. It can check the maximum and minimum values. The specifiable value is the range of Long. 16
22 <f:validatelongrange minimum="10" maximum="1000" /> The corresponding tags are prepared for these standard validators. They can be used by writing them within the tags to be checked. <h:inputtext value="#{mybean.message"> <f:validatelength minimum="5" maximum="9" /> </h:inputtext> Checking using method-binding A managed bean method can be written in the validatorattribute of the tag to be checked. However, only one validator can be specified in this method. To specify multiple validators, use standard validators or custom validators. [JSP coding example] <h:inputtext value="#{mybean.message" validator="#{mybean.validate" /> [Validator coding example] import javax.faces.application.facesmessage; import javax.faces.component.uicomponent; import javax.faces.context.facescontext; import javax.faces.validator.validatorexception; public class MyBean {... public void validate(facescontext context, UIComponent component, Object value){ // Coding of value check processing String text = (String)value; if(text.length() > 10){ throw new ValidatorException(new FacesMessage ("The number of characters exceeds 10.")); // The following method can be used alternatively: /* context.addmessage(component.getclientid(context), new FacesMessage ("The number of characters exceeds 10.")); ((UIInput)component).setValid(false); */ 17
23 Specify void for the return value of the method specified in the validator attribute. Use three arguments as shown in the above coding example. Their contents are as follows: FacesContext instance UIComponent that specifies the validator attribute Value to be verified For any error detected by the checking, error messages can be created and displayed with the javax.faces.application.facesmessage class, as shown in the above example. For details on how to display it, refer to Displaying Messages. Custom validators A custom validator that implements arbitrarily defined check logic can be created. A custom validator can be created by implementing the javax.faces.validator.validator interface. An example of a custom validator is shown below. [Example of a custom validator] import javax.faces.application.facesmessage; import javax.faces.component.uicomponent; import javax.faces.component.uiinput; import javax.faces.context.facescontext; import javax.faces.validator.validatorexception; public class MyValidator implements javax.faces.validator.validator { public void validate(facescontext context, UIComponent component, Object value) ValidatorException { String text = (String)value; if(text.length() > 10){ throws throw new ValidatorException(new FacesMessage ("The number of characters exceeds 10.")); // The following method can be used alternatively: /* context.addmessage(component.getclientid(context), new FacesMessage ("The number of characters exceeds 10.")); ((UIInput)component).setValid(false); */ For any error detected by the checking, error messages can be created and displayed with the javax.faces.application.facesmessage class, as shown in the above example. For details on how to display it, refer to Displaying Messages. Assign a validator ID to the validator thus created, and save it to the JavaServer Faces definition file 18
24 (faces-config.xml). The validator ID myvalidator is assigned to the validator in the following example. <faces-config>... <validator> <validator-id>myvalidator</validator-id> <validator-class>mypkg.myvalidator</validator-class> </validator>... </faces-config> Use the stored validator with a JSP page as shown below. <h:inputtext value="#{mybean.message"> <f:validator validatorid="myvalidator" /> </h:inputtext> 3.5 Creating a Converter A converter can be defined in the UIComponent that implements the javax.faces.component.valueholder interface. Converters can be used in two modes: use of standard converters that have already been prepared, or use of custom converters. Standard converters The following standard converters are available. BigDecimalConverter BigIntegerConverter BooleanConverter ByteConverter CharacterConverter DateTimeConverter DoubleConverter FloatConverter IntegerConverter LongConverter NumberConverter ShortConverter Conversion to java.math.bigdecimal Conversion to java.math.biginteger Conversion to java.lang.boolean Conversion to java.lang.byte Conversion to java.lang.character Conversion to a pattern that can be specified for java.text.simpledateformat Conversion to java.lang.double Conversion to java.lang.float Conversion to java.lang.integer Conversion to java.lang.long Conversion to a pattern that can be specified for java.text.decimalformat Conversion to java.lang.short To use a converter, specify the ID of the converter by using the tag converter attribute or the f:converter tag. To use a standard converter, specify "javax.faces.[converter name excluding Converter]" as the converter ID. For example, specify "javax.faces.bigdecimal". Custom converters A custom converter can be created to implement conversion to an arbitrarily specified object.create a custom 19
25 converter by implementing the javax.faces.convert.converter interface. [Example of a custom converter] import javax.faces.component.uicomponent; import javax.faces.context.facescontext; public class MyConverter implements javax.faces.convert.converter { public Object getasobject(facescontext context, UIComponent component, String value) { // Coding of the String -> Object conversion rules (upward conversion to the business logic) public String getasstring(facescontext context, UIComponent component, Object value) { // Coding of the Object -> String conversion rules (downward conversion to the display) Assign a converter ID to the converter thus created, and save it to the JavaServer Faces definition file (faces-config.xml). <faces-config>... <converter> <converter-id>myconverter</converter-id> <converter-class>mypkg.myconverter</converter-class> </converter>... </faces-config> Using a converter To use a converter, specify the ID of the converter. Specify the converter ID by writing it in the tag converter attribute or using the f:converter tag. Coding examples are shown below. [convert attribute] <h:inputtext value="#{mybean.bigdecimal" converter="javax.faces.bigdecimalconverter" /> [f:converter tag] <h:inputtext value="#{mybean.bigdecimal" > 20
26 <f:converter converterid="myconverter"/> </h:inputtext> 3.6 Creating a Page Transition Definition To create a page transition definition, use the navigation-rule tag in the JavaServer Faces definition file (faces-config.xml). [Sample JavaServer Faces definition file (faces-config.xml)] <faces-config>... <navigation-rule> <!-- Write the transition source JSP name. --> <from-view-id>/input.jsp</from-view-id> <!-- Change the transition destination depending on the action result. --> <navigation-case> <!-- Specify a transition to /result.jsp if the action result is success. --> <from-outcome>success</from-outcome> <to-view-id>/result.jsp</to-view-id> </navigation-case> <navigation-case> <!-- Specify a transition to /input.jsp if the action result is fail. --> <from-outcome>fail</from-outcome> <to-view-id>/input.jsp</to-view-id> </navigation-case> </navigation-rule>... </faces-config> The "action result" defined in the JavaServer Faces definition file (faces-config.xml) is the value of the action attribute of a button or anchor. The method of a page transition can be classified into the following two types according to how the action attribute is specified: static action and dynamic action. Static action Static action means that a fixed character string is specified as the value of the action attribute. Use this type of action when the page transition destination is fixed. [Example of use of static action] 21
27 <h:commandbutton action="success" value="send" /> Dynamic action Dynamic action means that a managed bean method is specified with a method binding expression for the action attribute value. The specified method is invoked when ActionEvent occurs, and its return value is the action result. The specified method must have no argument, and it must return String as the return value. Use dynamic action when the page transition destination varies depending on the processing result of the business logic. [Coding example of a JSP page using dynamic action] <h:commandbutton action="#{mybean.getidfornextpage" value="send" /> [Coding example of a managed bean using dynamic action] package mypkg; public class MyBean {... public String getidfornextpage() { // Changes the return value depending on the conditions. if (...) { return "success"; else { return "fail"; 3.7 Displaying Messages JavaServer Faces has a function for displaying messages by associating them with UIComponents.The function is mainly used to display an error message at the time that an error is detected in a validator.for example, a form may be sent with an input-required text field that has been left blank. In this case, a message such as "This item must be specified" can be displayed immediately under the text field. Associating messages with UIComponents Associating messages according to validator processing For details on how to associate messages with UIComponents according to validator processing, refer to Custom Validators. Associating messages with UIComponents according to processing other than validator processing Associate messages with UIComponents by using the addmessage method of the 22
28 javax.faces.context.facescontext class.use the javax.faces.application.facesmessage class to render messages.an example of associating messages in an action method is shown below. [Associating messages by using the addmessage method] import javax.faces.application.facesmessage; import javax.faces.component.uicomponent; import javax.faces.context.facescontext;... public String buyproduct() {... // Acquires FacesContext. FacesContext context = FacesContext.getCurrentInstance(); // Acquires the UIComponent with which a message is to be associated. // Here, the text field identified with id="productcodefield" is acquired from the form identified with id="myform" is acquired. UIComponent component = context.getviewroot().findcomponent("myform:productcodefield"); // Acquires the client ID of the UIComponent. String clientid = component.getclientid(context); // Creates a message. FacesMessage message = new FacesMessage ("The product code does not exist. Please check it."); // Associates the message with the UIComponent. context.addmessage(clientid, message);... Displaying the message associated with a UIComponent To display such a message, use the h:message tag or h:messages tag on the input-output page.the h:message tag is used to display only the message of the specified UIComponent.The h:messages tag is used to display messages of all UIComponents. An example of use of the h:message tag is shown below.to indicate the message to be displayed, specify the component ID of the UIComponent associated with the message. Specify the component ID in the for attribute. [Displaying messages by using the h:message tag] 23
29 <f:view> <h:form id="myform"> Product code <h:inputtext id="productcodefield" value="#{mybean.product" /> <br> <!-- Displays a message about the "Product code" text field. --> <h:message for="productcodefield" /> <br> Count <h:inputtext id="countfield" value="#{mybean.count" /> <br> <!-- Displays a message about the "Count" text field. --> <h:message for="countfield" /> <br>... <h:commandbutton action="#{mybean.buyproduct" value="buy"/> </h:form> </f:view> To display all messages in one place, use the h:messages tag. [Displaying messages by using the h:messages tag] <f:view> <h:form id="myform"> <!-- Displays all messages. --> <h:messages /> Product code <h:inputtext id="productcodefield" value="#{mybean.product" /> <br> Count <h:inputtext id="countfield" value="#{mybean.count" /> <br>... <h:commandbutton action="#{mybean.buyproduct" value="buy"/> </h:form> </f:view> 3.8 Character Encoding The character encoding of the response transmitted to a browser is specified by the contenttype attribute of the page directive of JSP. The example when ISO is specified is as follows. [Example of page directive described in JSP] 24
30 page contenttype="text/html; charset=iso " %> The character encoding of the request received from a browser is decided as follows. Therefore, the character encoding of the request need not be specified in the application. When the Content-Type header exists in the HTTP request received from a browser, and the character encoding is specified for the value, this character encoding is used. The same character encoding that transmits the last request of the same session is used, except for the above-mentioned. 25
31 26
32 Chapter 4 Development Using JavaServer Faces Tags JavaServer Faces supports the tags listed below. For details on each tag, refer to the JavaServer Faces Tag Reference. Basic tags Tag name f:actionlistner f:valuechangelistner f:attribute f:converter f:convertdatetime f:convertnumber f:facet f:loadbundle f:param f:selectitem f:selectitems f:subview f:validatedoublerange f:validatelength f:validatelongrange f:validator f:verbatim f:view Function Registers an action listener for the parent UIComponent. Registers a value change listener for the parent UIComponent. Specifies an attribute that can be specified for the parent UICompnent. Registers a converter in the parent UIComponent. Registers a DateTime converter in the parent UIComponent. Registers a Number converter in the parent UIComponent. Assigns a special name (e.g., a table header, footer) by enclosing it in this tag. Loads text from a resource file. Adds a parameter. Displays the item from the UISelectOne or UISelectMany component. Displays multiple items from the UISelectOne or UISelectMany component. Loads another JSP page containing JavaServer Faces tags. Registers DoubleRangeValidator in a UIComponent. Registers LengthValidator in a UIComponent. Registers LongRangeValidator in a UIComponent. Registers a custom validator in a UIComponent. Creates a UIOutput component that acquires the contents of this tag. Encloses all of the JavaServer Faces tags on a page. HTML tags Tag name Function Coding example Display h:column is used in combination with h:datatable to display one Use this tag in combination with h:datatable (refer to Examples of combinations). Refer to Examples of combinations. 27
33 Tag name Function Coding example Display h:commandbutton column of data in a table. Button used to send form data to a server <h:commandbutton value="send" action="send"/> Button (HTML <input> tag; the type is submit, reset, or image): h:commandlink Hyperlink used to send form data to a server <h:commandlink action="send"> <h:outputtext value="send"/> </h:commandlink> Hyperlink (HTML <a href> tag): h:datatable Displays a table based on a set (e.g., array) of data. Use this tag in combination with h:column (refer to Examples of combinations). Refer to Examples of combinations. h:form Creates a form. <h:form>... </h:form> Form (HTML <form> tag) <h:graphicimage h:graphicimage Displays an image. id="picture" url="/images/my_picture.gif" /> Image (HTML <img> tag) h:inputhidden Creates hidden send data of a form. <h:inputhidden id="hidden" value="#{mybean.hiddenpasswo rd"/> No display (HTML <input type=hidden> tag) h:inputsecret Text field for a password <h:inputsecret value="#{mybean.secretpasswo rd"/> Text field for password (HTML <input type=password> tag): h:inputtext Text field <h:inputtext value="#{mybean.inputtext"/ > Text field (HTML <input type=text> tag): h:inputtextarea Multi-line text field <h:inputtextarea value="#{mybean.inputtextare Multi-line text field (HTML <textarea> tag): 28
34 Tag name Function Coding example Display a"/> h:message Displays the message of a specific UIComponent. <h:message for="somecomponentid"/> Message h:messages Displays the messages of all UIComponents. <h:messages/> Messages h:outputlabel Displays a label that identifies an input field. <h:outputlabel for="userid"> <h:outputtext id="userid" value="#{mybean.userid"/> </h:outputlabel> Label (HTML <label> tag) h:outputlink Hyperlink to another page that creates no action event <h:outputlink value=" <h:outputtext value="somehost"/> </h:outputlink> Hyperlink (HTML <a href> tag): h:outputformat Creates text by inserting parameters into it according to the format and then displays it. <h:outputformat value="total is {0"> <f:param value="#{mybean.total"/> </h:outputformat> Text: Total is 123 h:outputtext Displays text. <h:outputtext value="hello world!"/> Text: Hello world! <h:panelgrid columns="2" border="1"> <f:facet name="header"> h:panelgrid Displays a table. <h:outputtext value="table title"/> </f:facet> table title value1 value2 <h:outputtext value="value1" /> <h:outputtext value="value2" /> </h:panelgrid> 29
35 Tag name Function Coding example Display h:panelgroup Groups UIComponents. Use this tag in combination with h:panelgrid (refer to Examples of combinations). Refer to Examples of combinations. h:selectbooleanch eckbox Single check box <h:selectbooleancheckbox value="#{mybean.selectboolea ncheckbox" /> Check box (HTML <input type=checkbox> tag): <h:selectmanycheckbox h:selectmanycheck box Multiple check boxes value="#{mybean.selectmanych eckbox1"> <f:selectitem itemlabel="option 1" itemvalue="check1"/> Multiple check boxes (HTML <input type=checkbox> tag): <f:selectitem itemlabel="option 2" itemvalue="check2"/> </h:selectmanycheckbox> <h:selectmanylistbox value="#{mybean.selectmanyli stbox"> h:selectmanylistb ox List box from which multiple options can be selected <f:selectitem itemlabel="list1" itemvalue="list1"/> <f:selectitem itemlabel="list2" itemvalue="list2"/> List box (HTML <select> tag): </h:selectmanylistbox> h:selectmanymenu List box with height 1 from which multiple options can be selected <h:selectmanymenu value="#{mybean.selectmanyme nu"> <f:selectitems value="#{selectmanylist"/> </h:selectmanymenu> List box (HTML <select> tag): h:selectonelistbo x List box from which a single option can be selected <h:selectonelistbox value="#{mybean.selectonelis tbox"> List box (HTML <select> tag): 30
36 Tag name Function Coding example Display <f:selectitems value="#{selectmanylist"/> </h:selectonelistbox> h:selectonemenu Combo box from which a single option can be selected <h:selectonemenu value="#{mybean.selectonemen u"> <f:selectitems value="#{selectmanylist"/> Combo box (HTML <select> tag): </h:selectonemenu> h:selectoneradio Multiple radio buttons <h:selectoneradio value="#{mybean.selectonerad io"> <f:selectitems value="#{selectmanylist"/> Multiple radio buttons (HTML <input type=radio> tag): </h:selectoneradio> [Examples of combinations] Combination tags Coding example Display <h:datatable value="#{mybean.items" var="item" border="1"> <h:column> <f:facet name="header"> <h:outputtext value="name"/> h:datatable h:column </f:facet> <h:outputtext value="#{item.name" /> </h:column> <h:column> name tabledata1 tabledata2 tabledata3 value memory1 memory2 memory3 <f:facet name="header"> <h:outputtext value="value"/> </f:facet> <h:outputtext value="#{item.value" /> </h:column> 31
04/29/2004. Advanced JavaServer Faces (Based on JSF Tutorial)
Advanced JavaServer Faces (Based on JSF Tutorial) 1 Sang Shin sang.shin@sun.com www.javapassion.com/j2eeadvanced Java Technology Evangelist Sun Microsystems, Inc. 2 Disclaimer & Acknowledgments Even though
More informationNew Fire system. The student assignment submission system for Computer Science Department of Chalmers. Master s Thesis in the Master Degree Program,
New Fire system The student assignment submission system for Computer Science Department of Chalmers Master s Thesis in the Master Degree Program, Software Engineering and Technology Yi Xu Department of
More informationDeveloping Web Applications using JavaServer Faces
Developing Web Applications using JavaServer Faces In the previous two chapters we covered how to develop web applications in Java using Servlets and JSPs. Although a lot of applications have been written
More informationThese tables are from the book Core JavaServer Faces by David Geary and Cay Horstmann, Sun Microsystems Press 2004.
These tables are from the book Core JavaServer Faces by David Geary and Cay Horstmann, Sun Microsystems Press 2004. Table 4 1 JSF Core Tags Tag f:view f:subview f:facet f:attribute f:param f:actionlistener
More informationAuthor: Sascha Wolski Sebastian Hennebrueder Tutorials for Struts, EJB, xdoclet and eclipse.
JavaServer Faces Developing custom converters This tutorial explains how to develop your own converters. It shows the usage of own custom converter tags and overriding standard converter of basic types.
More informationJSF Tags. This tutorial will cover a number of useful JSF tags. For a complete listing of available JSF tags consult the Oracle documentation at:
Overview @author R.L. Martinez, Ph.D. Java EE 7 provides a comprehensive list of JSF tags to support JSF web development. The tags are represented in XHTML format on the server and are converted into HTML
More informationIntroduction to Java Server Faces(JSF)
Introduction to Java Server Faces(JSF) Deepak Goyal Vikas Varma Sun Microsystems Objective Understand the basic concepts of Java Server Faces[JSF] Technology. 2 Agenda What is and why JSF? Architecture
More informationJSF Validating User Input
JSF Validating User Input Two tasks that almost every Web application needs to perform: Checking that all required form fields are present and in the proper format Redisplaying the form when values are
More informationJava TM. JavaServer Faces. Jaroslav Porubän 2008
JavaServer Faces Jaroslav Porubän 2008 Web Applications Presentation-oriented Generates interactive web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response
More informationJSF. What is JSF (Java Server Faces)?
JSF What is JSF (Java Server Faces)? It is application framework for creating Web-based user interfaces. It provides lifecycle management through a controller servlet and provides a rich component model
More informationTable of Contents. Introduction...xxix
Introduction....xxix Chapter 1: Getting Started with Web Applications in Java... 1 Introduction to Web Applications... 2 Benefits of Web Applications... 5 Technologies used in Web Applications... 5 Describing
More informationJSF Building input forms with the h library
JSF Building input forms with the h library We ve already seen some of the most commonly used tags: h:form No ACTION specified (it is current page automatically) You must use POST h:inputtext NAME generated
More informationE Eclipse debugging a JSF application, 25 downloading, 2 installing, 2 launching JBoss in, 3
Index A tag, 201 tag, 195 tag, 189, 194, 199 tag, 212 tag, 199 AbortProcessingException, 98 action attribute, 38, 107, 225
More information04/29/2004. Step by Step Guide for Building a simple JSF Application (Guess a Number) - V1.0
Step by Step Guide for Building a simple JSF Application (Guess a Number) - V1.0 1 Sang Shin sang.shin@sun.com www.javapassion.com Java Technology Evangelist Sun Microsystems, Inc. 2 Disclaimer & Acknowledgments
More informationPeter Norrhall. Callista Enterprise AB.
JavaServer Faces Peter Norrhall Callista Enterprise AB peter.norrhall@callista.se http://www.callista.se/enterprise CADEC 2004, JavaServer Faces, Slide 1 Rapid Application Development CADEC 2004, JavaServer
More informationSAP NetWeaver J2EE Preview: User Interfaces with JSF
SDN Contribution SAP NetWeaver J2EE Preview: User Interfaces with JSF Applies to: SAP NetWeaver J2EE Preview Summary Learn how to develop JSF-based front end. Author(s): SAP NetWeaver Product Management
More informationTable of Contents. Advanced Web Technologies 6) JSF Validators and Converters. Convert and Validate Input? Baisc JSF Lifecycle
Berner Fachhochschule-Technik und Informatik Advanced Web Technologies 6) JSF Validators and Converters Dr. E. Benoist Fall Semester 09-10 Table of Contents Motivations Basic JSF Lifecycle Why? / At what
More informationJava Server Faces - The View Part
Berne University of Applied Sciences Dr. E. Benoist Bibliography: Core Java Server Faces David Geary and Cay Horstmann Sun Microsystems December 2005 1 Table of Contents Internationalization - I18n Motivations
More informationContents. 1. JSF overview. 2. JSF example
Introduction to JSF Contents 1. JSF overview 2. JSF example 2 1. JSF Overview What is JavaServer Faces technology? Architecture of a JSF application Benefits of JSF technology JSF versions and tools Additional
More informationMore reading: A series about real world projects that use JavaServer Faces:
More reading: A series about real world projects that use JavaServer Faces: http://www.jsfcentral.com/trenches 137 This is just a revision slide. 138 Another revision slide. 139 What are some common tasks/problems
More informationCopyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum
JEE application servers at version 5 or later include the required JSF libraries so that applications need not configure them in the Web app. Instead of using JSPs for the view, you can use an alternative
More informationAdvanced Web Technology - Java Server Faces
Berne University of Applied Sciences Advanced Web Technology - Java Server Faces Dr. E. Benoist Bibliography: Mastering Java Server Faces B.Dudney et al. - Wiley November 2005 1 Table of Contents Model
More informationBerner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2
Table of Contents AWT 4) JSF Lifecycle, Event handling, data binding, i18n Emmanuel Benoist Fall Term 2016-17 Life-cycle Basic JSF Life-cycle Conversion and validation Invoke Application Actors in the
More informationJSF: The "h" Library Originals of Slides and Source Code for Examples:
2012 Marty Hall JSF: The "h" Library Originals of Slides and Source Code for Examples: http://www.coreservlets.com/jsf-tutorial/ This somewhat old tutorial covers JSF 1, and is left online for those maintaining
More informationJSF & Struts 1, 4, 7, 2, 5, 6, 3 2, 4, 3, 1, 6, 5, 7 1, 4, 2, 5, 6, 3, 7 1, 2, 4, 5, 6, 3, 7
1. Following are the steps required to create a RequestProcessor class specific to your web application. Which of the following indicates the correct sequence of the steps to achieve it? 1. Override the
More informationCHAPTER 12 VALIDATORS
CHAPTER 12 VALIDATORS OBJECTIVES After completing Validators, you will be able to: Describe the JSF validator architecture. Use standard validators and the required attribute to enforce basic input-validation
More informationType of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes
Java CORE JAVA Core Java Programing (Course Duration: 40 Hours) Introduction to Java What is Java? Why should we use Java? Java Platform Architecture Java Virtual Machine Java Runtime Environment A Simple
More informationS AMPLE CHAPTER. Foreword by Ed Burns. JavaServer Faces IN AC TION. Kito Mann MANNING
Foreword by Ed Burns S AMPLE CHAPTER JavaServer Faces IN AC TION Kito Mann MANNING JavaServer Faces in Action by Kito Mann Sample Chapter 4 Copyright 2004 Manning Publications PART 1 EXPLORING JAVASERVER
More informationSession 24. Introduction to Java Server Faces (JSF) Robert Kelly, Reading.
Session 24 Introduction to Java Server Faces (JSF) 1 Reading Reading IBM Article - www.ibm.com/developerworks/java/library/jjsf2fu1/index.html Reference Sun Tutorial (chapters 4-9) download.oracle.com/javaee/6/tutorial/doc/
More informationMastering JavaServer Faces
Mastering JavaServer Faces Bryan Basham Software Alchemist basham47@gmail.com http://www.linkedin.com/in/softwarealchemist Bryan Basham Mastering JavaServer Faces Slide 1 Topics Mind Map Introduction to
More informationApcoordinator User's Guide J2X ENZ2(00)
Apcoordinator User's Guide J2X1-1190-01ENZ2(00) Contents Part 1 Frameworks Provided by Apcoordinator...1 Chapter 1 Product Overview...3 1.1 About Apcoordinator... 3 1.2 Apcoordinator Features... 5 1.3
More informationThree hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 21 st May Time:
COMP67032 Three hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Building Web Applications Date: Friday 21 st May 2010 Time: 14.00 17.00 Answer Question 1 from Section A and TWO questions out
More informationWeb Development in Java Part II
Web Development in Java Part II Vítor E. Silva Souza (vitorsouza@inf.ufes.br) http://www.inf.ufes.br/ ~ vitorsouza Department of Informatics Federal University of Espírito Santo (Ufes), Vitória, ES Brazil
More informationCHAPTER 12 VALIDATORS
CHAPTER 12 VALIDATORS OBJECTIVES After completing Validators, you will be able to: Describe the JSF validator architecture. Use standard validators and the required attribute to enforce basic input-validation
More informationAdvanced Web Technologies 8) Facelets in JSF
Berner Fachhochschule, Technik und Informatik Advanced Web Technologies 8) Facelets in JSF Dr. E. Benoist Fall Semester 2010/2011 1 Using Facelets Motivation The gap between JSP and JSF First Example :
More informationJavaServer Faces 2.0. Sangeetha S E-Commerce Research Labs, Infosys Technologies Ltd
JavaServer Faces 2.0 Sangeetha S E-Commerce Research Labs, Infosys Technologies Ltd 2010 Infosys Technologies Limited Agenda JSF 2.0 Overview of New Features Facelets Annotations Composite Components Ajax
More informationExample jsf-cdi-and-ejb can be browsed at
JSF-CDI-EJB Example jsf-cdi-and-ejb can be browsed at https://github.com/apache/tomee/tree/master/examples/jsf-cdi-and-ejb The simple application contains a CDI managed bean CalculatorBean, which uses
More informationJava Server Pages. JSP Part II
Java Server Pages JSP Part II Agenda Actions Beans JSP & JDBC MVC 2 Components Scripting Elements Directives Implicit Objects Actions 3 Actions Actions are XML-syntax tags used to control the servlet engine
More informationOracle Developer Day
Oracle Developer Day Sponsored by: J2EE Track: Session #3 Developing JavaServer Faces Applications Name Title Agenda Introduction to JavaServer Faces What is JavaServer Faces Goals Architecture Request
More informationCHAPTER 2 LIFECYCLE AND PAGE NAVIGATION
CHAPTER 2 LIFECYCLE AND PAGE NAVIGATION OBJECTIVES After completing Lifecycle and Page Navigation, you will be able to: Describe the JSF framework in terms of singleton objects that carry out tasks behind
More informationJavaServer Faces Specification
JavaServer Faces Specification Version 20040513 Expert Draft Craig McClanahan, Ed Burns, Roger Kitain, editors Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. 650-960-1300 February
More informationAttached Object, UI Component Wovening of Attributes using Meta Rule API - JSF
Attached Object, UI Component Wovening of Attributes using Meta Rule API - JSF Vijay Kumar Pandey Director of Technology Solutions, Intueor Consulting, Inc. Irvine, CA (United States of America) Abstract.
More informationAnno Accademico Laboratorio di Tecnologie Web. Esempio di progetto
Universita degli Studi di Bologna Facolta di Ingegneria Anno Accademico 2007-2008 Laboratorio di Tecnologie Web Esempio di progetto http://www lia.deis.unibo.it/courses/tecnologieweb0708/ Template project
More informationBuilding Web Applications With The Struts Framework
Building Web Applications With The Struts Framework ApacheCon 2003 Session TU23 11/18 17:00-18:00 Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc. Slides: http://www.apache.org/~craigmcc/
More informationJavaServer Faces Specification
JavaServer Faces Specification Final Draft Version 2.2 Ed Burns editor See to comment on and discuss this specification. Oracle America, Inc 500 Oracle Parkway Redwood Shores,
More informationAdvanced Graphics Components Using JavaServer Faces Technology. Christophe Jolif Architect ILOG S.A.
Advanced Graphics Components Using JavaServer Faces Technology Christophe Jolif Architect ILOG S.A. http://www.ilog.com Goal of the Session Learn how to build JavaServer Faces technology advanced graphics
More informationJSF 2.0 Cookbook. Over 100 simple but incredibly effective recipes for taking control of your JSF applications. Anghel Leonard BIRMINGHAM - MUMBAI
JSF 2.0 Cookbook Over 100 simple but incredibly effective recipes for taking control of your JSF applications Anghel Leonard BIRMINGHAM - MUMBAI JSF 2.0 Cookbook Copyright 2010 Packt Publishing All rights
More informationweb.xml Deployment Descriptor Elements
APPENDIX A web.xml Deployment Descriptor s The following sections describe the deployment descriptor elements defined in the web.xml schema under the root element . With Java EE annotations, the
More informationJava EE 6: Develop Web Applications with JSF
Oracle University Contact Us: +966 1 1 2739 894 Java EE 6: Develop Web Applications with JSF Duration: 4 Days What you will learn JavaServer Faces technology, the server-side component framework designed
More informationJSF Navigation.!! DevelopIntelligence
JSF Navigation! JSF Navigation "!Navigation between views controlled by FacesServlet "! Typically initiated as a result of an action "! Standard HTML links do NOT go through FacesServlet "!Navigation depends
More informationJavaServer Faces Specification
JavaServer Faces Specification Version 2.3 Ed Burns and Manfred Riem editors Early Draft Review See to comment on and discuss this specification. Oracle America, Inc 500 Oracle
More informationJava Technologies Java Server Faces (JSF)
Java Technologies Java Server Faces (JSF) The Context Web Components (Servlets, JSP, Beans, etc.) = The Bricks needed for creating Web Apps Frameworks are sets of design patterns, APIs, and runtime implementations
More informationsessionx Desarrollo de Aplicaciones en Red EL (2) EL (1) Implicit objects in EL Literals José Rafael Rojano Cáceres
sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano EL Expression Language Write the code in something else, just let EL call it. EL () EL stand for Expression
More informationTable of Contents Fast Track to JSF 2
Table of Contents Fast Track to JSF 2 Fast Track to JavaServer Faces (JSF 2) 1 Workshop Overview / Student Prerequisites 2 Workshop Agenda 3 Typographic Conventions 4 Labs 5 Release Level 6 Session 1:
More informationJSF. Events. Events and the JSF Life Cycle
JSF Events Events and the JSF Life Cycle Typically, you register event handlers with components for example, you might register a value change listener with a menu in a JSF page, like this:
More informationModule 3 Web Component
Module 3 Component Model Objectives Describe the role of web components in a Java EE application Define the HTTP request-response model Compare Java servlets and JSP components Describe the basic session
More informationThe biggest advantage of the JSF technology is its flexible, extensible component model, which includes: An extensible component API for the usual
1 2 3 The biggest advantage of the JSF technology is its flexible, extensible component model, which includes: An extensible component API for the usual standard components. Developers can also create
More informationAJAX in Apache MyFaces A New Approach To Web Applications
AJAX in Apache MyFaces A New Approach To Web Applications Gerald Müllan Matthias Weßendorf 1 Gerald Müllan Apache MyFaces contributor Web-Engineer with focus on JavaServer Faces Integration of AJAX into
More informationADF Code Corner. 97. How-to defer train-stop navigation for custom form validation or other developer interaction. Abstract: twitter.
ADF Code Corner 97. How-to defer train-stop navigation for custom form Abstract: ADF developers can declaratively define a bounded task fow to expose a train model for users to navigate between views.
More informationGetting Started Guide. Version 1.7
Getting Started Guide Version 1.7 Copyright Copyright 2005-2008. ICEsoft Technologies, Inc. All rights reserved. The content in this guide is protected under copyright law even if it is not distributed
More informationA Red Hat Perspective
TITLE JSR-314: SLIDE: JavaServer HEADLINE Faces 2.0 Presenter A Red Hat Perspective name Title, Red Hat Date Dan Allen Senior Software Engineer, RedHat JSR-314 Expert Group Member October 8, 2009 1 Roadmap
More informationAnno Accademico Corso di Tecnologie Web Web Application: Java Server Faces Core e HTML tags
Universita degli Studi di Bologna - Facolta di Ingegneria Anno Accademico 2006-2007 Corso di Tecnologie Web Web Application: Java Server Faces Core e HTML tags http://www-lia.deis.unibo.it/courses/tecnologieweb0607/
More informationSeam & Web Beans. Pete Muir JBoss, a division of Red Hat.
Seam & Web Beans Pete Muir JBoss, a division of Red Hat http://in.relation.to/bloggers/pete pete.muir@jboss.org 1 Road Map Background Seam Web Beans 2 Advantages of JSF/JPA over Struts/EJB 2 Fewer, finer
More informationJSF - H:PANELGRID. JSF Tag. Rendered Output. Tag Attributes. The h:panel tag renders an HTML "table" element. Attribute & Description.
http://www.tutorialspoint.com/jsf/jsf_panelgrid_tag.htm JSF - H:PANELGRID Copyright tutorialspoint.com The h:panel tag renders an HTML "table" element. JSF Tag
More informationFINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar
FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar www.vuhelp.pk Solved MCQs with reference. inshallah you will found it 100% correct solution. Time: 120 min Marks:
More informationWeb Browser and Web Server Interaction View Static Webpage (p.3) View static webpage stored on a web server machine
Object Oriented Programming and Internet Application Development Unit 7 Browser Based Internet Software Web Development with Java Servlet JavaServer Page (JSP) JavaServer Face (JSF) 07 - Browser Based
More informationVery short introduction to JavaServer Faces
Very short introduction to JavaServer Faces Example of an JSF application Application consists from two HTML pages The first page allows to enter a number, and as a result outputs squared number Example
More information8 JSF, Images, CSS, and JS
8 JSF, Images, CSS, and JS In this chapter, we will cover: Injecting CSS in JSF JSF, CSS, and tables JSF and dynamic CSS Integrating JavaScript and JSF Getting a JSF inputtext value from JavaScript Working
More informationPortlet Application Development Webinar exercise using JSF and JPA with Rational Application Developer
Portlet Application Development Webinar exercise using JSF and JPA with Rational Application Developer This exercise demonstrates how to create an end-to-end Java Persistence API (JPA) enabled Java Server
More informationHello Worldwide Web: Your First JSF in JDeveloper
Now I Remember! Hello Worldwide Web: Your First JSF in JDeveloper Peter Koletzke Technical Director & Principal Instructor There are three things I always forget. Names, faces, and the third I can t remember.
More informationIntroduction to Seam. Pete Muir. JBoss, a division of Red Hat
Introduction to Seam Pete Muir JBoss, a division of Red Hat Road Map Background Seam concepts Seam with Wicket (at the BOF) Seam Extras 2 Advantages of JSF/JPA over Struts/EJB 2 Fewer, finer grained artifacts
More informationGoing Above and Beyond JSF 2 with RichFaces & Seam
Going Above and Beyond JSF 2 with RichFaces & Seam Jay Balunas Principal Software Engineer Lincoln Baxter, III Senior Software Engineer JBoss, By Red Hat Inc Who's the big guy? Jay Balunas RichFaces Project
More informationSECTION I: INTRODUCTION TO JAVA EE 1. INTRODUCTION TO JAVA...
SECTION I: INTRODUCTION TO JAVA EE 1. INTRODUCTION TO JAVA... 1 HISTORY OF JAVA... 3 WHERE IS JAVA USED?... 4 JAVA ARCHITECTURE AND ITS COMPONENTS... 5 The Java Class File... 6 Java Runtime Environment...
More informationFacelets and its use in Web Applications
10 Facelets and its use in Web Applications As of version 2 of this specification, JavaServer Faces implementations must support (although JSF-based applications need not utilize) using Facelets as the
More informationJavaServer Pages. What is JavaServer Pages?
JavaServer Pages SWE 642, Fall 2008 Nick Duan What is JavaServer Pages? JSP is a server-side scripting language in Java for constructing dynamic web pages based on Java Servlet, specifically it contains
More informationJava.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC.
TRAINING & REFERENCE murach's Java.. servlets and 2ND EDITION Joel Murach Andrea Steelman IlB MIKE MURACH & ASSOCIATES, INC. P 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com
More informationJSF Page Navigation. The first example we ll look at is available as jsf_ex2a.zip on your notes page.
JSF Page Navigation In this section, we ll look at how page navigation works using JSF. The examples in this section and the other sections are modified examples from courses.coresevlets.com. The first
More information8 Workspaces and Concurrent Conversations
8 Workspaces and Concurrent Conversations As we discussed in the previous chapter, you can have multiple conversations in an HTTP session. It's easy to see how a user can have several consecutive conversations
More informationPSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming
PSD1B Advance Java Programming Unit : I-V PSD1B- Advance Java Programming 1 UNIT I - SYLLABUS Servlets Client Vs Server Types of Servlets Life Cycle of Servlets Architecture Session Tracking Cookies JDBC
More informationJSF Templates. Library JSF Tag Libraries Namespace Prefix
JSF Templates Library JSF Tag Libraries Namespace Prefix Core http://java.sun.com/jsf/core f: HTML http://java.sun.com/jsf/html h: Facelets http://java.sun.com/jsf/facelets ui: Composite Components http://java.sun.com/jsf/composite
More informationSession 11. Expression Language (EL) Reading
Session 11 Expression Language (EL) 1 Reading Reading Head First pages 368-401 Sun Java EE 5 Chapter 5 in the Tutorial java.sun.com/javaee/5/docs/tutorial/doc/javaeetutorial.pdf / / / / / Reference JSTL
More informationOracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)
Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand) Code: URL: D101074GC10 View Online The Developing Applications for the Java EE 7 Platform training teaches you how
More informationCreating your first JavaServer Faces Web application
Chapter 1 Creating your first JavaServer Faces Web application Chapter Contents Introducing Web applications and JavaServer Faces Installing Rational Application Developer Setting up a Web project Creating
More informationSeam. Pete Muir JBoss, a Division of Red Hat.
Seam Pete Muir JBoss, a Division of Red Hat http://in.relation.to/bloggers/pete pete.muir@jboss.org 1 Road Map Background Seam Future 2 Advantages of JSF/JPA over Struts/EJB 2 Fewer, finer grained artifacts
More informationSession 21. Expression Languages. Reading. Java EE 7 Chapter 9 in the Tutorial. Session 21 Expression Languages 11/7/ Robert Kelly,
Session 21 Expression Languages 1 Reading Java EE 7 Chapter 9 in the Tutorial 2 11/7/2018 1 Lecture Objectives Understand how Expression Languages can simplify the integration of data with a view Know
More informationJ2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.
J2EE Development Detail: Audience www.peaksolutions.com/ittraining Java developers, web page designers and other professionals that will be designing, developing and implementing web applications using
More informationJavaServer Faces Technology, AJAX, and Portlets: It s Easy if You Know How!
TS-6824 JavaServer Faces Technology, AJAX, and Portlets: It s Easy if You Know How! Brendan Murray Software Architect IBM http://www.ibm.com 2007 JavaOne SM Conference Session TS-6824 Goal Why am I here?
More informationA Gentle Introduction to Java Server Pages
A Gentle Introduction to Java Server Pages John Selmys Seneca College July 2010 What is JSP? Tool for developing dynamic web pages developed by SUN (now Oracle) High-level abstraction of Java Servlets
More informationJ2EETutorial.book Page 1405 Thursday, June 3, :26 AM. Index
J2EETutorial.book Page 1405 Thursday, June 3, 2004 10:26 AM Index : (colon), in XML markup, 43, 47. (period) JSP operator, 491 492 in XML markup, 43 & (ampersand) entity for, 49 SAX processing, 127 &&
More informationWriting Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p.
Preface p. xiii Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. 11 Creating the Deployment Descriptor p. 14 Deploying Servlets
More informationPES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II
PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II Subject Name: Advanced JAVA programming Subject Code: 13MCA42 Time: 11:30-01:00PM Max.Marks: 50M ----------------------------------------------------------------------------------------------------------------
More informationLiferay Faces. Reference Documentation ga4
Liferay Faces Reference Documentation 3.1.3-ga4 Liferay Faces Copyright 2000-2013 Liferay, Inc. All rights reserved. Legal Notice Copyright 2000-2013 Liferay, Inc. All rights reserved. This copyrighted
More informationJavaServer Pages and the Expression Language
JavaServer Pages and the Expression Language Bryan Basham Sun Microsystems, Inc. bryan.basham@sun.com Page 1 Topics Covered History of the Expression Language (EL) Overview of the EL EL Namespace EL Operators
More informationLiferay Faces. Reference Documentation ga2
Liferay Faces Reference Documentation 3.1.1-ga2 Liferay Faces Copyright 2000-2012 Liferay, Inc. All rights reserved. Legal Notice Copyright 2000-2012 Liferay, Inc. All rights reserved. This copyrighted
More informationSESM Components and Techniques
CHAPTER 2 Use the Cisco SESM web application to dynamically render the look-and-feel of the user interface for each subscriber. This chapter describes the following topics: Using SESM Web Components, page
More information11.1 Introduction to Servlets
11.1 Introduction to Servlets - A servlet is a Java object that responds to HTTP requests and is executed on a Web server - Servlets are managed by the servlet container, or servlet engine - Servlets are
More informationApplication Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started
Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features
More informationGenerating a JavaServer Faces 2.0 CRUD Application from a Database
1 z 24 2010-12-20 10:34 Generating a JavaServer Faces 2.0 CRUD Application from a Database In this tutorial, you use the NetBeans IDE to create a web application that interacts with a back-end database.
More informationUniversité du Québec à Montréal
Laboratoire de Recherches sur les Technologies du Commerce Électronique arxiv:1803.05253v1 [cs.se] 14 Mar 2018 Université du Québec à Montréal How to Implement Dependencies in Server Pages of JEE Web Applications
More information