4 Replies Latest reply on Jul 10, 2007 7:04 AM by agrimm

    Problem with SEAM and Ajax4JSF 1.1.1

    knisterpeter

      I'm using Seam 1.2.1.GA, JSF RI 1.2, Facelets 1.1.12 and A4J 1.1.1 and run into the following problem:

      When I first request the page (I think a4j is not involved) I'll get a good response and the page is displayed. Then when I enter somethink in an input field annotated with a4j:support onBlur an ajax request is started. So far so good. But the response is not displayed, instead the whole page disapears and no keystrokes are accepted anymore (like F6 to get to the location bar).
      On the server-side no errors or stacktraces are logged, and on the client side the log is attached below (got from a4j:log).
      Does anybody have an idea what I did wrong? Without a4j it does work as expected.

      debug[11:24:33,472]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: blur
      debug[11:24:33,473]: NEW AJAX REQUEST !!! with form :j_id5
      debug[11:24:33,475]: Append hidden control j_id5 with value [j_id5] and value attribute [j_id5]
      debug[11:24:33,476]: Append text control j_id5:username with value [] and value attribute [null]
      debug[11:24:33,477]: Append password control j_id5:password with value [] and value attribute []
      debug[11:24:33,479]: Append hidden control javax.faces.ViewState with value [j_id1:j_id2] and value attribute [j_id1:j_id2]
      debug[11:24:33,480]: parameter j_id5:j_id13 with value j_id5:j_id13
      debug[11:24:33,482]: Start XmlHttpRequest
      debug[11:24:33,485]: Reqest state : 1
      debug[11:24:33,486]: QueryString: AJAXREQUEST=_viewRoot&j_id5=j_id5&j_id5%3Ausername=&j_id5%3Apassword=&javax.faces.ViewState=j_id1%3Aj_id2&j_id5%3Aj_id13=j_id5%3Aj_id13&
      debug[11:24:33,492]: Reqest state : 1
      debug[11:24:33,672]: Reqest state : 2
      debug[11:24:33,676]: Reqest state : 3
      debug[11:24:33,685]: Reqest state : 4
      debug[11:24:33,686]: Reqest end with state 4
      debug[11:24:33,687]: Response with content-type: application/xhtml+xml;charset=UTF-8
      debug[11:24:33,688]: Full response content: <!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"> <head> <title>LLynch KingPin</title>...
      debug[11:24:33,690]: Header Ajax-Response not found, search in <meta>
      debug[11:24:33,691]: search for elements by name 'meta' in element #document
      debug[11:24:33,701]: getElementsByTagName found 0
      warn[11:24:33,702]: No ajax response header
      debug[11:24:33,703]: Header Location not found, search in <meta>
      debug[11:24:33,704]: search for elements by name 'meta' in element #document
      debug[11:24:33,705]: getElementsByTagName found 0
      debug[11:24:35,392]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: blur
      debug[11:24:35,393]: NEW AJAX REQUEST !!! with form :j_id5
      debug[11:24:35,395]: Append hidden control j_id5 with value [j_id5] and value attribute [j_id5]
      debug[11:24:35,396]: Append text control j_id5:username with value [] and value attribute [null]
      debug[11:24:35,397]: Append password control j_id5:password with value [] and value attribute []
      debug[11:24:35,399]: Append hidden control javax.faces.ViewState with value [j_id1:j_id3] and value attribute [j_id1:j_id3]
      debug[11:24:35,400]: parameter j_id5:j_id24 with value j_id5:j_id24
      debug[11:24:35,402]: Start XmlHttpRequest
      debug[11:24:35,404]: Reqest state : 1
      debug[11:24:35,406]: QueryString: AJAXREQUEST=_viewRoot&j_id5=j_id5&j_id5%3Ausername=&j_id5%3Apassword=&javax.faces.ViewState=j_id1%3Aj_id3&j_id5%3Aj_id24=j_id5%3Aj_id24&
      debug[11:24:35,411]: Reqest state : 1
      debug[11:24:35,752]: Reqest state : 2
      debug[11:24:35,756]: Reqest state : 3
      debug[11:24:35,757]: Reqest state : 4


        • 1. Re: Problem with SEAM and Ajax4JSF 1.1.1

          Hi,

          at the moment I have got the same problem. I tried to open the page in the IE7 and it work fine. But I get a warning in the a4j:log with says that: No ajax response header. - So the whole page should be rerendert.

          After look around for a while, I found out, that if the current view is left, i.e. folloing a navigationRule from the faces-config. A new view is created and the whole page is rerended. If not, everything is fine.
          So, I guess this is a wanted behaviour with A4J. But does anybody know how to get the Mozialle to refresh the whole page?

          • 2. Re: Problem with SEAM and Ajax4JSF 1.1.1

            Hi,

            I made up a little demo-application wich will demonstrate the effect.
            It can be donwloaded from http://www.starprinz.de/firefoxProblem.zip.

            • 3. Re: Problem with SEAM and Ajax4JSF 1.1.1
              ilya_shaikovsky

              No need to return any outcome to reRender the components. so in yiur example commandControl should be just

              <a4j:commandButton reRender="outputName" value="Say Hello" />
              


              Also it's no need to wrap the buttion with a4j region since you perform input field processing also.

              • 4. Re: Problem with SEAM and Ajax4JSF 1.1.1

                Hi ilya_shaikovsky,
                thanks for your reply.

                With the example, I wanted to demonstrate in a simple way, the behavour of the Firefox browser after a viewChange. Tha's why I didn't use a rerender for the outputName. Image you want do your editing in a modelPanel and you want to have the panel open as long the the view is keep because of validation errors. Only if there is no error, the page should reload complety. Making therefor the modalPanel hidden again.

                Have you tried the example in the Firefox and the IE?

                Best regards
                Achim