3 Replies Latest reply on Oct 5, 2009 10:29 PM by shadowcreeper

    Richfaces failure when jsp:include with jspx file

    shadowcreeper

      When I jsp:include a jspx file, Richfaces stops working. Below is a test case.

      If I replace the jsp:include with an a4j:include, it works. Can anybody explain why?

      Thanks.
      -Shadow

      I am using:
      Richfaces 3.3.1.GA
      JBoss 5.1.0.GA (and the JSF library there in)

      Broken JSF page:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html
       PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      
      <%@ page contentType="text/html;charset=UTF-8" language="java" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich" %>
      <%
       // Make page expire immediately
       response.setHeader( "Expires", "Sat, 6 May 1995 12:00:00 GMT" );
       response.setHeader( "Cache-Control", "no-store, no-cache, must-revalidate" );
       response.addHeader( "Cache-Control", "post-check=0, pre-check=0" );
       response.setHeader( "Pragma", "no-cache" );
      %>
      
      <f:view>
       <html xmlns="http://www.w3.org/1999/xhtml">
       <head>
       <a4j:loadScript src="resource://prototype.js" />
       <f:verbatim><title>Richfaces with jsp:include of jspx file test</title></f:verbatim>
       </head>
       <body onload="load();" onunload="GUnload();">
       <jsp:include page="test1.jspx"/>
       <h:commandButton value="Click Me" onclick="Richfaces.showModalPanel('testModalPanel')"/>
       </body>
       </html>
      </f:view>
      


      JSPX file:
      <jsp:root xmlns="http://www.w3.org/1999/xhtml"
       xmlns:jsp="http://java.sun.com/JSP/Page"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       version="2.0">
      
       <f:subview id="test1Subview">
       <rich:modalPanel id="testModalPanel"
       resizeable="false"
       moveable="false"
       width="425" height="350">
       <f:facet name="header">
       <h:outputText value="It worked!"/>
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="/images/close_btn.png" style="cursor:pointer;"
       onclick="Richfaces.hideModalPanel('testModalPanel');"/>
       </f:facet>
       <h:outputText style="font-weight:bold;" value="Congratulations!!!" escape="false"/>
       </rich:modalPanel>
       </f:subview>
      
      </jsp:root>
      



        • 1. Re: Richfaces failure when jsp:include with jspx file
          shadowcreeper

          One more thing...

          It doesn't matter if there are any richfaces compnents in the jspx file or not.

          You will see the same behavior if the jspx file contains only an h:outputText and the modalPanel is in the main jsp file.

          It appears that simply including a jspx file with jsp:include is enough to kill Richfaces, regardless of the file's contents.

          • 2. Re: Richfaces failure when jsp:include with jspx file
            shadowcreeper

            Tested with newly released Richfaces v3.3.2.GA and the bug still exists.

            test.jsp:

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE html
             PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
            
            <%@ page contentType="text/html;charset=UTF-8" language="java" %>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
            <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j" %>
            <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich" %>
            <%
             // Make page expire immediately
             response.setHeader( "Expires", "Sat, 6 May 1995 12:00:00 GMT" );
             response.setHeader( "Cache-Control", "no-store, no-cache, must-revalidate" );
             response.addHeader( "Cache-Control", "post-check=0, pre-check=0" );
             response.setHeader( "Pragma", "no-cache" );
            %>
            
            <f:view>
             <html xmlns="http://www.w3.org/1999/xhtml">
             <head>
             <title>Richfaces with jsp:include of jspx file test</title>
             </head>
             <body>
             <h:commandButton value="Click Me" onclick="Richfaces.showModalPanel('testModalPanel')"/>
             <rich:modalPanel id="testModalPanel"
             resizeable="false"
             moveable="false"
             width="425" height="350">
             <f:facet name="header">
             <h:outputText value="It worked!"/>
             </f:facet>
             <f:facet name="controls">
             <h:graphicImage value="/images/close_btn.png" style="cursor:pointer;"
             onclick="Richfaces.hideModalPanel('testModalPanel');"/>
             </f:facet>
             <h:outputText style="font-weight:bold;" value="Congratulations!!!" escape="false"/>
             </rich:modalPanel>
             <%-- Comment out the following line and the modalPanel will magically start working. --%>
             <jsp:include page="test.jspx"/>
             </body>
             </html>
            </f:view>
            


            test.jspx:
            <jsp:root xmlns="http://www.w3.org/1999/xhtml"
             xmlns:jsp="http://java.sun.com/JSP/Page"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             version="2.0">
            
             <f:subview id="test1Subview">
             <h:outputText value="jspx file contents"/>
             </f:subview>
            
            </jsp:root>
            


            • 3. Re: Richfaces failure when jsp:include with jspx file
              shadowcreeper