【发布时间】:2011-05-09 11:22:32
【问题描述】:
我正在尝试在我的 glassfish 服务器的根目录中部署一个 JSF-2 应用程序,以便 http://localhost:8080/ 指向我的欢迎页面。出于某种原因,在尝试进行配置时,http://localhost:8080/ 会导致 glassfish 默认欢迎页面,而 http://localhost:8080// 会导致我的。如果我转到http://localhost:8080/<welcome-page> 它可以工作,所以上下文根似乎在大多数情况下都可以工作,只是欢迎页面在某种程度上具有错误的映射。
如何解决这个问题?
sun-web.xml:
<sun-web-app error-url="">
<context-root>/</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
web.xml(减去安全约束和其他不相关的东西)
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<filter-mapping>
<filter-name>AlreadyLoggedInRedirectFilter</filter-name>
<url-pattern>/login.jsf</url-pattern>
</filter-mapping>
<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>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>AlreadyLoggedInRedirectFilter</filter-name>
<filter-class>com.xdin.competence.jsf.util.AlreadyLoggedInRedirectFilter</filter-class>
</filter>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/viewExpired.jsf</location>
</error-page>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/login.jsf</form-error-page>
</form-login-config>
</login-config>
附带说明,该应用程序不是服务器的默认应用程序,我只是希望它部署在根目录中。
【问题讨论】:
标签: java jsf-2 glassfish-3