如何部署jsf2.0的程序到glassfish v3 prelude上?
taoman
2009-08-09
下载的glassfish v3 prelude,用pkg list -a发现列表中有jsf2.0和jsf1.0。
下载了mojarra-2.0.0-Beta2,使用了其中的example,但是不管我是用了war还是用webcontent文件夹形式来部署(使用glassfish web console),网页要嘛显示The requested service () is not currently available,要嘛干脆直接下载没有解析过的原始xhtml文件下来。 根据论坛上surpass的这篇文章http://surpass.iteye.com/blog/440957,我自己也写了个简单的helloworld,却报javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20 另外我没有拷贝mojarra-2.0.0-Beta2的那两个jsf jar包到应用程序的lib下,拷贝也没有用。 1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>testjsf2</display-name> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> 2.helloworld.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:head> <title>Hello World</title> <meta http-equiv="keywords" content="enter,your,keywords,here" /> <meta http-equiv="description" content="A short description of this page." /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> </h:head> <h:body> <h:form id="form"> <div style="padding: 100px 0 0 100px; font-size: 22px; font-weight: bold"> Hello,#{helloBean.name}!</div> </h:form> </h:body> </html> 2.HelloWorldBean.java package com.demo; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name = "helloBean") @SessionScoped public class HelloWorldBean implements java.io.Serializable { private static final long serialVersionUID = 6866250699219535733L; private String name; /** * @return the name */ public String getName() { this.name = "World"; return name; } } |
|
taoman
2009-08-09
已经搞定,原来要吧glassfish中默认的jsf1.2删了再装jsf2.0
|