The use and experience of JSF (Java Server face)

Source: Internet
Author: User
Js|server
How to use Java Server Face (JFS) in Eclipse+myeclipse: Create a JSF project based on MyEclipse's introduction to the JSF Creation wizard.   The details are as follows: 1.J2EE's WEB Project Project creation 2. Add JSF packages to the project (adding JSF capabilities to a WEB project) create the related packages and configuration files. 3. Add JFS page (a special format file in JSP) Note: There are generally two packages introduced in the page taglib as follows: <%@ taglib uri= "http://java.sun.com/jsf/html" prefix= "H"%> Mainly is the page processing taglib <%@ taglib uri= "Http://java.sun.com/jsf/core" prefix= "F"%>//mainly is the page displays the encapsulation taglib,   For example, extract the key configurable display from the package. Properties. 4. Create related packages and classes. Is usually the class used for processing.   (i.e. JavaBean)   5. Need to modify or rewrite JavaBean and JSF as needed. 7. To modify the configuration file: For example,. properties files, face-config.xml files, etc. 6. Deploy to the server with a generic deployment method. can be run. (The server version of the request is relatively high, weblogic8.1 to these taglib have a warning)

Explain the:  1. For some configurable page content, it can be placed under the relevant package. Then in the JFS file      <f:loadbundle basename= "com. Login.messagebundle "var=" bundle "/>      where COM. Login.messagebundle represents a reference to a name-value pair of messagebundle.properties file contents under Com.login packages            bundle is a variable in the JFS file, owning the name in the. properties file as a property, and the corresponding value is the property value. He can be referenced elsewhere.   2. Communicate between JavaBean and JF through the Faces-config.xml file. Similar to struts-config.    <faces-config>    <navigation-rule>         <from-view-id>/Login.jsp</from-view-id><---The first page to display, His processing results are from JavaBean, but subsequent pages are shown by the return <from-outcome> corresponding labels and are indicated by <to-view-id>. -->        <navigation-case>             <from-outcome>success</from-outcome>             <to-view-id>/loginsuccessfully.jsp</to-view-id>        </navigation-case>         <navigation-case>            < from-outcome>failure</from-outcome>            <to-view-id>/Login.jsp</to-view-id>        </navigation-case >    </navigation-rule>    <managed-bean><--The definition of the bean used-->         <description>bean used to handle all user-based operations.</ description>        <managed-bean-name>userbean</ managed-bean-name>        <managed-bean-class>com. login.use.userbean</managed-bean-class>        <managed-bean-scope >session</managed-bean-scope>   <--represents-->    </managed-bean></faces-config>3 during the applicable session. You can refer to the related. tld file for details of the label's properties. 4. Pages can be used directly, set up, request JavaBean methods and properties.     For example:
Summary: JSF simply separates the processing business from the presentation, and also separates the content of the page. This not only realizes the separation of processing and the page, but also realizes the separation of the page content.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.