myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <>
Subject [jira] Commented: (MYFACES-1692) CommandLink does not execute action if no javascript is allowed
Date Tue, 01 Apr 2008 08:56:24 GMT


Thomas Fischer commented on MYFACES-1692:

As written in my comment from 11/Oct/07 03:16 AM, the patch is not desirable in its original
form. In fact, the JSF specs say that a commandLink MUST submit the form which is not possible
without Javascript as far as I know. 
So any solution in the "original" direction would involve a custom component, probably with
reduced functionality even with javascript disabled (no form submit). However, as I wrote
above, the problem with this approach is if the custom component is inside a form for layout
reasons, then the decode method would not be called in the current implementation.

The idea of rendering a button so that it looks like a link would be a good solution to this
problem. I'm not sure it is entirely feasible, though. I have just talked to a colleague who
tried to do this, and he says that e.g. underlining a text in a button in firefox is a problem
even in the current firefox versions. I do not know whether this addition is submitted in
myfaces or not.

> CommandLink does not execute action if no javascript is allowed
> ---------------------------------------------------------------
>                 Key: MYFACES-1692
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Tomcat 6.0, javax.faces.STATE_SAVING_METHOD=server, org.apache.myfaces.ALLOW_JAVASCRIPT=false
>            Reporter: Thomas Fischer
> 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).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message