1 2 Previous Next 15 Replies Latest reply on Jul 10, 2007 5:01 AM by Achim Grimm

    Any A4J submit rerenders blank page

    Tim Romanowski Newbie

      Hi everyone, I've been looking over the docs, FAQ and this forum and am wondering if my problem is very basic, since I haven't seen it come up.

      I have pages with regular JSFtags and a couple A4J tags. Whenever any A4J component submits an ajax request, the page hangs for a second,
      then rerenders a blank page.

      Here is a snippet:


      <a4j:region selfRendered="true">
       <h:form>
       <a4j:outputPanel id="MyPanel">
       <h:panelGrid rendered="#{myBean.rendered}">
       <h:outputText value="This is a test."/>
       </h:panelGrid>
       <h:outputText value="Show text: "/>
       <h:selectBooleanCheckbox
       value="true" action="null">
       <a4j:support event="onclick"
       actionListener="#{myBean.updateIsRendered}"
       reRender="MyPanel">
       </a4j:support>
       </h:selectBooleanCheckbox >
       </a4j:outputPanel>
       </h:form>
       </a4j:region>
      



      The same thing happens in versions 1.0.5 and 1.0.7 and 1.1.0 (latest release).

      I am using Ajax4JSF 1.1.0 and Tomahawk 1.1.5 (there are no Tomahawk components on the pages causing problems).
      My app server is Glassfish v2 build 40, running JSF RI 1.2.

      Here are snippets of my web.xml:

       <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
       </context-param>
      
      ... SNIP ...
      
       <!-- ************************ AJAX4JSF Filter **************************** -->
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class>org.ajax4jsf.Filter</filter-class>
      
       <init-param>
       <param-name>forceparser</param-name>
       <param-value>false</param-value>
       </init-param>
       </filter>
      
      
       <!-- Must use the *.faces URL pattern, else a JTidy nullpointerexception is thrown! -->
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <!--<url-pattern>*.faces</url-pattern> -->
       <servlet-name>Faces Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
       <!-- ************************ Tomahawk Filter **************************** -->
       <filter>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
       <init-param>
       <param-name>maxFileSize</param-name>
       <param-value>20m</param-value>
       </init-param>
       </filter>
      
       <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
       <filter-mapping>
       <filter-name>MyFacesExtensionsFilter</filter-name>
       <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
       <servlet-name>Faces Servlet</servlet-name>
       </filter-mapping>
      
      ... SNIP ...
      
       <!-- ************************ Faces Servlet Mapping **************************** -->
       <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>
      


      Using firebug, I'm not seeing any javascript errors, and when the page goes blank, firebug is still showing all the original source in my browser (Firefox v2).
      My app does not support IE (because I refuse to put in a billion workarounds), so I cannot test it in that browser to compare.


      Any suggestions?

        • 1. Re: Any A4J submit rerenders blank page
          Sergey Smirnov Master

          what was the strong reason you have selfRendered="true" ?

          • 2. Re: Any A4J submit rerenders blank page
            Tim Romanowski Newbie

            No reason one way or another; back with 1.0.5 (many months ago), I added the tag and was under the impression that it fixed a problem whereby an update was not taking place. The documentation states "if 'true' , self-render subtree at InvokeApplication ( or Decode, if immediate property set to true ) phase." So I don't understand how that would be related.

            I've removed the "selfRendered" attribute just now and it did not change the problem.

            • 3. Re: Any A4J submit rerenders blank page
              Sergey Smirnov Master

              the rest code seems fine. so, the problem is somewhere outside. Do you have any test project we can look at?

              • 4. Re: Any A4J submit rerenders blank page
                Tim Romanowski Newbie

                I don't have a test app, and considering the complexity of the app it would be non trivial to strip out a test case. I will try to put one together from scratch and hopefully will find it is a library issue (I have added woodstock recently--just the jars, did not actually use it or add a filter to my web.xml).

                One thing I did notice, is that it looks like the Ajax submit IS working--I can see firefox very quickly retreiving additional data onclick of my checkbox. But the whole page is blank (white)!

                I am using OSCache 2.3.2--should I be using 2.3 instead?

                • 6. Re: Any A4J submit rerenders blank page
                  Ilya Shaikovsky Master

                  1) May be there is some exceptions on server side? (There was some problems while handling them in earlier versions)

                  And please try to use a4j:log component to check the client side log of the request.

                  • 7. Re: Any A4J submit rerenders blank page
                    Tim Romanowski Newbie

                    Hi Ilya,

                    1) No, unfortunately (or maybe this is good?), there were no errors in my server logs. No warning, or anything unusually--it is as if everything is running fine.

                    2) I've tried a4j log, but nothing happens (to be honest, that particular tag I have never had luck getting to work with any version--even when other A4J tags worked). I assigned the control character to the semi-colon (";") since Firefox has nearly every other key used.


                    In the next couple days I will try to get a test project and run some more procedures to see if I can narrow this down.

                    Thanks for the tips!

                    • 8. Re: Any A4J submit rerenders blank page
                      Tim Romanowski Newbie

                      Some new information: was able to get the a4j log tag working (had to set "popup='true'").

                      debug[15:29:51,629]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: change
                      debug[15:29:51,629]: NEW AJAX REQUEST !!! with form :j_id63
                      debug[15:29:51,629]: parameter j_id63:j_id75 with value j_id63:j_id75
                      debug[15:29:51,629]: Start XmlHttpRequest
                      debug[15:29:51,629]: Reqest state : 1
                      debug[15:29:51,629]: QueryString: AJAXREQUEST=j_id63%3Aj_id71&j_id63%3AnatlId=&j_id63%3Aname=&j_id63%3Acc=UK&j_id63%3Adescription=&j_id63%3Aj_id74=Area&j_id63_SUBMIT=1&javax.faces.ViewState=j_id12%3Aj_id15&j_id63%3Aj_id75=j_id63%3Aj_id75&
                      debug[15:29:51,644]: Reqest state : 1
                      debug[15:29:52,237]: Reqest state : 2
                      debug[15:29:52,237]: Reqest state : 3
                      debug[15:29:52,237]: Reqest state : 3
                      debug[15:29:52,237]: Reqest state : 3
                      debug[15:29:52,237]: Reqest state : 3
                      debug[15:29:52,253]: Reqest state : 3
                      debug[15:29:52,253]: Reqest state : 3
                      debug[15:29:52,253]: Reqest state : 3
                      debug[15:29:52,253]: Reqest state : 3
                      debug[15:29:52,253]: Reqest state : 3
                      debug[15:29:52,268]: Reqest state : 4
                      debug[15:29:52,268]: Reqest end with state 4
                      debug[15:29:52,268]: Response with content-type: application/xhtml+xml;charset=UTF-8
                      debug[15:29:52,268]: Full response content: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <head
                      [ ... SNIP ... ]
                      debug[15:29:52,268]: Header Ajax-Response not found, search in
                      debug[15:29:52,268]: search for elements by name 'meta' in element #document
                      debug[15:29:52,268]: getElementsByTagName found 0
                      warn[15:29:52,268]: No ajax response header
                      debug[15:29:52,284]: Header Location not found, search in
                      debug[15:29:52,284]: search for elements by name 'meta' in element #document
                      debug[15:29:52,284]: getElementsByTagName found 0



                      Does this provide anything useful? In the snipped code, the entire page contents is sent. But for whatever reason, only a blank page is displayed. Any other suggestions?

                      • 9. Re: Any A4J submit rerenders blank page
                        Sergey Smirnov Master

                        sounds like filter dos not involved at all. What is the full content of the web.xml?

                        • 10. Re: Any A4J submit rerenders blank page
                          Ilya Shaikovsky Master

                          Creation a simple case will be very usefull for us. Thanks.

                          • 11. Re: Any A4J submit rerenders blank page
                            Tim Romanowski Newbie

                             

                            <?xml version="1.0" encoding="UTF-8"?>
                            <web-app version="2.5" 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-app_2_5.xsd">
                            
                            
                             <context-param>
                             <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                             <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                             </context-param>
                            
                             <context-param>
                             <param-name>org.ajax4jsf.SKIN</param-name>
                             <param-value>blueSky</param-value>
                             </context-param>
                            
                             <!-- Use prefix-mapping instead of suffix-mapping.
                             This allows us to support both *.xhtml and *.jsp files -->
                             <context-param>
                             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                             <param-value>/faces/*</param-value>
                             </context-param>
                            
                             <!-- Special Debug Output for Development -->
                             <context-param>
                             <param-name>facelets.DEVELOPMENT</param-name>
                             <param-value>true</param-value>
                             </context-param>
                            
                             <!-- Tell facelets whether or not to skip comments before compiling -->
                             <context-param>
                             <param-name>facelets.SKIP_COMMENTS</param-name>
                             <param-value>true</param-value>
                             </context-param>
                            
                             <!-- The buffer size to set on the response when the ResponseWriter is generated.
                             By default the value is -1, which will not assign a buffer size on the response. -->
                             <context-param>
                             <param-name>facelets.BUFFER_SIZE</param-name>
                             <param-value>16384</param-value>
                             </context-param>
                            
                             <!-- For using Tomahawk and FacesTrace components with Facelets -->
                             <context-param>
                             <param-name>facelets.LIBRARIES</param-name>
                             <param-value>
                             /WEB-INF/facestrace.taglib.xml;/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sandbox.taglib.xml;
                             </param-value>
                             </context-param>
                            
                             <context-param>
                             <param-name>com.sun.faces.verifyObjects</param-name>
                             <param-value>false</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>org.ajax4jsf.SKIN</param-name>
                             <param-value>DEFAULT</param-value>
                             </context-param>
                             -->
                            
                            
                             <context-param>
                             <param-name>javax.faces.CONFIG_FILES</param-name>
                             <param-value>/WEB-INF/faces-config.xml,/WEB-INF/navigation.xml</param-value>
                             </context-param>
                            
                            
                             <context-param>
                             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                             <param-value>server</param-value>
                             </context-param>
                            
                            
                            
                            
                             <!-- ************************ AJAX4JSF Filter **************************** -->
                             <filter>
                             <display-name>Ajax4jsf Filter</display-name>
                             <filter-name>ajax4jsf</filter-name>
                             <filter-class>org.ajax4jsf.Filter</filter-class>
                            
                             <init-param>
                             <param-name>forceparser</param-name>
                             <param-value>false</param-value>
                             </init-param>
                             </filter>
                            
                            
                             <!-- Must use the *.faces URL pattern, else a JTidy nullpointerexception is thrown! -->
                             <filter-mapping>
                             <filter-name>ajax4jsf</filter-name>
                             <!--<url-pattern>*.faces</url-pattern> -->
                             <servlet-name>Faces Servlet</servlet-name>
                             <dispatcher>REQUEST</dispatcher>
                             <dispatcher>FORWARD</dispatcher>
                             <dispatcher>INCLUDE</dispatcher>
                             </filter-mapping>
                            
                            
                            
                             <!-- ************************ Tomahawk Filter **************************** -->
                             <filter>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                             <init-param>
                             <param-name>maxFileSize</param-name>
                             <param-value>20m</param-value>
                             </init-param>
                             </filter>
                            
                             <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
                             <servlet-name>Faces Servlet</servlet-name>
                             </filter-mapping>
                            
                             <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                             </filter-mapping>
                            
                             <!-- BEGIN ADD FOR EXTENSIONS FILTER -->
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <url-pattern>*.faces</url-pattern>
                             </filter-mapping>
                            
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <url-pattern>*.jsf</url-pattern>
                             </filter-mapping>
                            
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <url-pattern>*.jsp</url-pattern>
                             </filter-mapping>
                            
                             <filter-mapping>
                             <filter-name>MyFacesExtensionsFilter</filter-name>
                             <url-pattern>/faces/*</url-pattern>
                             </filter-mapping>
                             <!-- END ADD FOR EXTENSIONS FILTER -->
                            
                            
                             <!-- ************************ Faces Servlet Mapping **************************** -->
                             <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>
                            
                            
                            
                             <session-config>
                             <session-timeout>
                             30
                             </session-timeout>
                             </session-config>
                             <welcome-file-list>
                             <welcome-file>
                             index.jsp
                             </welcome-file>
                             </welcome-file-list>
                            
                            </web-app>
                            



                            Additionally, I have NOT added the view handler to my faces-config.xml file.

                            • 12. Re: Any A4J submit rerenders blank page
                              Tim Romanowski Newbie

                              Hi guys, at this point I'm stumped. I created a test project as requested, but could not repeat the problem.
                              I used the the exact same web.xml file as for my original web app (including adding the same taglibs and all jars as in my original web app), even created a similar facelets template.

                              Here is what else I tested in the problem app, grasping at straws:
                              I removed templating from the problematic page.
                              Ajax4jsf still causes the screen blanking problem.

                              I removed all components from the page except for the a4j code I posted above (a set of three radio buttons). Still have the problem.

                              I also took the working bean code from the test app I created and used that for the value of the selectOneRadio component a4j is rerendering, and that code fails to work in my primary app.

                              I've stopped my server, built a clean war, and deployed it. Same problem.

                              I've cleared the cache in my browser and made sure its size is greater than 0, but no dice.

                              Also, I downloaded and installed Firefox 1.5.0.11 with the hope that somehow Firefox 2.0.3 was the problem, but the same error happens there.

                              Lastly, I did end up testing this in Internet Explorer 6, and it works fine! So, somehow this is related to Firefox, but I have no idea what it is.
                              Short of sending the whole project (which, unfortunately, I can't do), is there anything else you guys would suggest I take a look at? Any more info I can provide that I haven't yet mentioned?

                              Thanks for your help thus far,

                              T

                              • 13. Re: Any A4J submit rerenders blank page
                                Tim Romanowski Newbie

                                Looks like I've come circle... it turns out that I had not been doing anything wrong with the code at all (best I can tell).
                                Despite rebooting my computer, and even undeploying/redploying my war, I was still having a problem.
                                So, I shutdown Glassfish V2 build40 and tried running both my test app and the original app on Glassfish V2 build34. Same problem.

                                After that, I removed jfreechart and another library (don't remember if it was tomahawk, sandbox or facelets), then added them back in. Next, for no particular reason, I shutdown build34 of the app server and started back up build40. After doing a clean build (based on the remove/add of the jars), the app is running fine. I can't explain it--perhaps my IDE (netbeans) was hosing up the ant build process and not actually updating the war when it should have been, despite all the clean builds I had done before? I can only speculate.

                                So, for anyone else encountering a similar problem, I highly recommend the following:

                                Undeploy your war.
                                Shutdown your app server.
                                If using netbeans, remove all libraries/jars from your project. Do a clean build (this will delete your build directory, but fail to compile since you don't have the requisite jars).
                                Add back in your jars/libraries.
                                Build your project.
                                Start you server and deploy your war.


                                Perhaps not completely logical, that is the best I can offer as far as an explanation goes. Sergey, Ilya, thanks for looking at this. If you have any comments, they are welcome.


                                One last question: how does one prevent postings (are code tags the culprit?) from being so wide?

                                • 14. Re: Any A4J submit rerenders blank page
                                  Sergey Smirnov Master

                                  I can recommend two ways:
                                  1. Using "Preview" button and correct the post before submission. Some long line might be cut manually. For example, the state saving data does not make sense for investigations.

                                  2. Using external paste service such as http://eugeneciurana.com/pastebin

                                  1 2 Previous Next