使用t:dataScroller与MyFaces 2.1.5 Tomahawk 1.1.11 Spring 3.0.5时出错

时间:2012-01-17 14:31:22

标签: spring jsf myfaces tomahawk

我正在从mojarra 1.2升级到myfaces 2.使用t:dataScroller标记生成以下错误:

  

java.io.FileNotFoundException:/WEB-INF/javax.faces.resource/oamSubmit.xhtml在ExternalContext中找不到作为资源

代码段:

<t:dataScroller id="${name}" for="#{forTable}"
      fastStep="10"
      pageIndexVar="pageIndex"    
      paginator="true"
      paginatorMaxPages="10"
      pageCountVar="pageCountVar"
      rowsCountVar="rowsCountVar"
      firstRowIndexVar="firstRowIndexVar"
      lastRowIndexVar="lastRowIndexVar"
      rowIndexVar="rowIndexVar"         
      paginatorRenderLinkForActive="false"
      >

我页面生成的javascript代码段如下:

.. src="/app/javax.faces.resource/oamSubmit.js?ln=org.apache.myfaces"> .. 

我猜测 oamSubmit 的某个地方是作为facelet标签而不是javascript返回的。我认为它可能是一个配置参数,但还没有找到正确的值。

Web.xml片段:

<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>
</servlet-mapping>

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
 </context-param>

faces-config.xml中

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

更新 更多堆栈跟踪详细信息:

WEB-INF/javax.faces.resource/oamSubmit.xhtml Not Found in ExternalContext as a Resource
    at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:227)
    at org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:170)
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage._getFacelet(FaceletViewDeclarationLanguage.java:2530)
    at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:435)
    at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:77)
    at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
    at org.springframework.faces.mvc.JsfView.renderMergedOutputModel(JsfView.java:85)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)

weblog中的调度程序servlet参数

<servlet>
    <servlet-name>myApp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>myApp</servlet-name>
    <url-pattern>/app/*</url-pattern>   
</servlet-mapping>

我想我需要告诉Dispatcher按原样提供静态内容,而不是JSF。

2 个答案:

答案 0 :(得分:0)

我在web.xml中将上下文参数设置为true。

RENDERED_JSF_JS
RENDERED_MYFACES_JS
RENDER_FORM_SUBMIT_SCRIPT_INLINE

这似乎可以解决问题。当然我还有其他问题,但我认为它们没有关系。

答案 1 :(得分:0)

我可以确认,使用RENDER_FORM_SUBMIT_SCRIPT_INLINE是我的案例中标题中某个外部文件中包含的缺少的javascript函数'oamSubmitForm'的变通方法。以下链接可能有助于找到真正的问题:http://jacekbilski.blogspot.de/2009/07/including-javascript-in-html-content.html

  <context-param>
    <param-name>org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE</param-name>
    <param-value>true</param-value>
  </context-param>