Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1692

CommandLink does not execute action if no javascript is allowed

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.2.0
    • None
    • General
    • None
    • Tomcat 6.0, javax.faces.STATE_SAVING_METHOD=server, org.apache.myfaces.ALLOW_JAVASCRIPT=false

    Description

      Situation:
      The tag <h:commandLink action="#

      {someBean.someAction}

      " value="submit"></h:commandLink> is used in a jsp page, which is visited by the user. The user clicks on the link.

      Expected behaviour:
      The method someBean.someAction() should be called, and the navigation rule which matches the outcome should determine the page to be displayed.

      Wrong behaviour:
      The method defined in action is not called and the same jsp page is rendered again.

      I did some debugging to find the reason of this problem. It seems to me that the server does not recognize that the click on the link is a postback. In line 172 in org.apache.myfaces.renderkit.html.HtmlResponseStateManager, the HTTP Parameter ResponseStateManager.VIEW_STATE_PARAM is checked for existence. If it is there, the request is a callback, and if it is not there, the request is not treated as postback. This parameter is not encoded in the link rendered by h:commandLink, thus the request is not treated as a postback, and the page is just rendered again.

      If javaScript rendering is allowed, this works fine because the HTTP parameter ResponseStateManager.VIEW_STATE_PARAM is rendered as a hidden input field, and the javascript code does a form submit.

      It seems to me that the problem could be solved by adding the parameter ResponseStateManager.VIEW_STATE_PARAM to the generated link (but I did not check it).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tfischer Thomas Fox
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: