jsf_inaction 2 helloworld

启动exlipse 新建 dynamic web project ,然后把相关的目录拷贝到workspace中。 

注意要把webcontent 修改成web 把lib 包直接考到web-inf下面就能够加载了,

编写页面, 和backingbean

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <display-name>JSF in Action - Hello, World!</display-name>
  <context-param>
  <param-name>javax.faces.CONFIG_FILES</param-name> 
  <param-value>
   /WEB-INF/conf/jsf/faces-config.xml
  </param-value>
 </context-param>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
   
</web-app>

 

faces-config.xml
<?xml version="1.0"?>

<!DOCTYPE faces-config PUBLIC
  "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">

<faces-config>

  <navigation-rule>
    <description>Navigation from the hello page.</description>
    <from-view-id>/hello.jsp</from-view-id>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/goodbye.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>

  <managed-bean>
    <description>The one and only HelloBean.</description>
    <managed-bean-name>helloBean</managed-bean-name>
    <managed-bean-class>org.jia.hello.HelloBean
    </managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>

</faces-config>

 

基本上就可以发布了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值