JSF标签未处理

时间:2012-11-11 18:13:42

标签: spring google-app-engine jsf-2 maven-gae-plugin

我正在尝试在Google应用引擎上运行jsf 2.1 / spring 3.1应用。这一切都很好(在开发服务器上)没有任何例外。

但是我访问的每个页面都没有处理jsf-tags。

  • 在没有模板的页面上,将呈现所有HTML。 jsf-tags在源代码中可见。
  • 在带有模板的页面上,浏览器显示带有提示的普通xhtml,没有可用的布局信息,这对我来说很有意义,因为只有部件被发送到浏览器。

在我看来,JSF根本不工作。虽然JSF似乎正确地被初衷化了。

我正在使用maven-gae-plugin版本0.9.2,因为我无法使用最新版本0.9.5将我的应用程序部署到开发服务器。

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

  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</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.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>

  <!-- GAE Bug 1506 JSP 2.1 API but 2.0 Implementation -->
  <context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
  </context-param>

  <context-param>
    <param-name>com.sun.faces.validateXml</param-name>
    <param-value>true</param-value>
  </context-param>

  <context-param>
    <param-name>com.sun.faces.enableThreading</param-name>
    <param-value>false</param-value>
  </context-param>


  <!-- Add Support for Spring -->
  <listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>

   <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </context-param>
  <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
  </listener>

<!-- Welcome page -->
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list> 

   <!-- JSF Mapping -->
  <servlet>
    <servlet-name>facesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

 <servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>

的index.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!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" >

    <h:body>

        <h1>JSF 2.0 + Spring Example</h1>

    <h:link value="Register" outcome="register" />

    <h2>TEST</h2>

    </h:body>

</html>

faces-config.xml中

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

问候。

0 个答案:

没有答案