Error using t:dataScroller with MyFaces 2.1.5 Tomahawk 1.1.11 Spring 3.0.5

1.1k Views Asked by At

I am in the middle of upgrading from mojarra 1.2 to myfaces 2. Using the t:dataScroller tag is generating the following error :

java.io.FileNotFoundException: /WEB-INF/javax.faces.resource/oamSubmit.xhtml Not Found in ExternalContext as a Resource

Code snippet:

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

The generated javascript snippet for my page is as follows:

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

I'm guessing somewhere along the line oamSubmit is being returned as a facelet tag instead of javascript. I thought it might be a configuration parameter, but have yet to find the correct value.

Web.xml snippets:

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

Updated: More stack trace details:

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)

And dispatcher servlet params in web.xml

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

I think I need to tell the Dispatcher to serve static content as is, rather than an JSF.

2

There are 2 best solutions below

0
On

I set the context parameters to true in my web.xml.

RENDERED_JSF_JS
RENDERED_MYFACES_JS
RENDER_FORM_SUBMIT_SCRIPT_INLINE

That seemed to do the trick. Of course I still have other problems, but I think they are un-related .

0
On

I can confirm, using RENDER_FORM_SUBMIT_SCRIPT_INLINE is a workaround to the missing javascript function 'oamSubmitForm' included in an external file somewhere in the header in my case. The following link might help to find the real problem: 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>