prime faces jsf页面不会在linux tomcat上呈现,但会在eclipse测试环境中呈现

时间:2012-10-22 12:00:29

标签: spring tomcat primefaces

我第一次发帖,所以如果我打破protocalls我道歉

我创建了一个项目,使用Eclipse运行Primefaces,在Windows上运行tomcat 6服务器,应用程序运行完全正常,当应用程序移动到“实时”服务器时,这是一个linux框,屏幕将不会显示< / p>

当我尝试使用jsf扩展(login.jsf)访问linux框上的url时,所有库都被复制了,当我尝试使用.xhtml扩展时,我发现了404错误(登录。 xhtml)我重温了代码的xml视图

我的web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <welcome-file-list>
    <welcome-file></welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>myApp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>WEB-INF/applicationContext.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  </servlet>
  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
  </context-param>
  <servlet-mapping>
    <servlet-name>myApp</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>log4jtLocation</param-name>
    <param-value>/WEB-INF/log4j.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>
  <listener>
    <listener-class>
      org.springframework.web.context.ContextLoaderListener
   </listener-class>
  </listener>
  <listener>
    <listener-class>
          org.springframework.web.context.request.RequestContextListener
       </listener-class>
  </listener>
</web-app>

我的login.xhtml

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition 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"
          xmlns:p="http://primefaces.org/ui"
          template = "template/template.xhtml">
    <h:head>

    </h:head>
    <ui:define name="body">
    <h:form id="form">

    <p:growl id="growl" showDetail="true" /> 


          <p:panel>
                <p:panelGrid columns="2">
                        <h:outputLabel value="Username:"/>
                        <p:inputText value = "#{loginUI.username}"/>

                        <h:outputLabel value="Password"/>
                        <p:password value = "#{loginUI.password}"/>


                </p:panelGrid>
                <p:commandButton value="Login" actionListener="#{loginUI.login}" update="growl"/> 

          </p:panel>
    </h:form>
    </ui:define>
    </ui:composition>
    [/code]

我的面部配置文件

 <?xml version="1.0" encoding="UTF-8"?>

    <faces-config
        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-facesconfig_2_1.xsd"
        version="2.1">

         <application>
      <el-resolver>
              org.springframework.web.jsf.el.SpringBeanFacesELResolver
      </el-resolver>
       </application>

    </faces-config>

当我启动tomcat时,日志中没有错误

提前致谢

1 个答案:

答案 0 :(得分:0)

在servlet中

<servlet-name>Faces Servlet</servlet-name>

<load-on-startup>1</load-on-startup>

并在servlet中

<servlet-name>myApp</servlet-name>

<load-on-startup>2</load-on-startup>