JSF学习笔记一

1.需要的.jar包
jsf-impl.jar
jsf-api.jar
commons-digester.jar
commons-collections.jar
commons-beanutils.jar
jstl.jar
standard.jar

2.配置web.xml

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>

3. 编写JavaBean
4. 配置faces-config.xml文件
<faces-config>
<navigation-rule>
<from-view-id>/page/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/page/welcome.jsp</to-view-id>
</navigation-case>
                <navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/page/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>com.zdx.Users</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>


5. 编写jsp页面
   引入jsf的f,h标签(core和html)
   core是有关于UI组件的处理,html是有关与html的进阶标签
   <f:view>类似与<html>的作用,放在最外层

要下班了,先到这......

你可能感兴趣的:(jsp,UI,xml,servlet,JSF)