spring - prime faces jsf 页面不会在 linux tomcat 上呈现,但会在 eclipse test env 上呈现

标签 spring tomcat primefaces

我是第一次发帖,所以如果我破坏了协议(protocol),我深表歉意

我创建了一个项目,该项目使用 Eclipse 和 tomcat 6 服务器在 Windows 上使用 Spring 运行 Primefaces,应用程序运行得非常好,当应用程序移动到“实时”服务器(即 linux 框)时,屏幕将不会显示

所有库都按应有的方式复制,当我尝试使用 jsf 扩展名(login.jsf)访问 linux 机器上的 url 时,我收到 404 错误,当我尝试使用 .xhtml 扩展名(登录。 xhtml) 我收到代码的 xml View

我的 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>

我的登录.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 时,日志中没有错误

提前致谢

最佳答案

在小服务程序中

<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>

关于spring - prime faces jsf 页面不会在 linux tomcat 上呈现,但会在 eclipse test env 上呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13011011/

相关文章:

java - 为什么我在 jsf 和 jpa 项目中使事务已经处于 Activity 状态?

jsf - primefaces 输入文本 除空格外的任何字符

Spring security BasicAuthenticationFilter 返回 403 而不是 401

spring - 将 spring security 添加到我当前的 springmvc

java - Tomcat JMX - 连接到服务器但找不到我想要的 MBean

file-upload - 如何使用 <p :fileUpload> 限制允许上传的文件数量

Spring Data Solr @Transaction 提交

java - JHipster 后端 - 社交登录

java - 这个 Tomcat 服务器启动错误是什么?

java - 在 server.xml 之外定义上下文时遇到问题