You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mark Li (JIRA)" <de...@myfaces.apache.org> on 2010/05/14 05:07:01 UTC

[jira] Created: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

CommandLink didnt have id by default, will cause ajax problem
-------------------------------------------------------------

                 Key: MYFACES-2715
                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.0
            Reporter: Mark Li


<h:commandLink/>
will output
<a hre="#" onclick="om..."/>
not id by default.
I think it will cause ajax problem.

suggestion:
in HtmlCommandLinkeBase.java
should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
instead of 
HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);



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


[jira] Commented: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867394#action_12867394 ] 

Werner Punz commented on MYFACES-2715:
--------------------------------------

Ok I fixed the issue on my side however there still is a problem there, we have to render an id if an onclick handler is set
it would be even better to always render an id.

The problem is <a href=".."jsf.ajax.request(this" />
will issue a window as source root, however we have to pass the issuing dom element to determine its parent form.

 I will adjust my code also to check for the event source if the parent form is not determinable by the source here.
(I am not sure how mojarra deals with all this but in either way)


> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Issue Comment Edited: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867394#action_12867394 ] 

Werner Punz edited comment on MYFACES-2715 at 5/14/10 1:23 AM:
---------------------------------------------------------------

Ok I fixed the issue on my side however there still is a problem there, we have to render an id if an onclick handler is set
it would be even better to always render an id.

The problem is <a href=".."jsf.ajax.request(this" />
will issue a window as source root, however we have to pass the issuing dom element to determine its parent form.

 I will adjust my code also to check for the event source if the parent form is not determinable by the source here.
Expect the fixup with the big refactoring commit sometime today.

Anyway I did a quick testrun, and mojarra also bends the spec here by taking the event object into consideration if 
no identifier on the issuing element is given:

following code produces following result

<h:commandLink value="xxx" onclick="jsf.ajax.request(this,event,{execute:'@this', render:'b'} ); return false;" />

<a href="#" onclick="jsf.util.chain(this,event,'jsf.ajax.request(this,event,{execute:\'@this\', render:\'b\'} ); return false;','mojarra.jsfcljs(document.getElementById(\'b\'),{\'j_idt15\':\'j_idt15\'},\'\')');return false">xxx</a>

b	b
javax.faces.ViewState	8626977924605851210:-14735535136190249
javax.faces.partial.ajax	true
javax.faces.partial.event	click
javax.faces.partial.execu...	
javax.faces.partial.rende...	b
javax.faces.source	
search4

The request clearly indicates that the source form was determined outside of the spec by using also
the event object as fallback here. 
So the spec here again, is at fault, I will file a bugreport on this one on the spec side, and as I said I will fix it to
reflect mojarras behavior (I already did) because it simply makes sense, to do it to cover those corner cases.



      was (Author: werpu):
    Ok I fixed the issue on my side however there still is a problem there, we have to render an id if an onclick handler is set
it would be even better to always render an id.

The problem is <a href=".."jsf.ajax.request(this" />
will issue a window as source root, however we have to pass the issuing dom element to determine its parent form.

 I will adjust my code also to check for the event source if the parent form is not determinable by the source here.
(I am not sure how mojarra deals with all this but in either way)

  
> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Commented: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867475#action_12867475 ] 

Werner Punz commented on MYFACES-2715:
--------------------------------------

ok I fixed this issue on my side be using also the event target as source for the issuer if the original issuer cannot be determined by the passed src element. This works well for me, and also follows the "undocumented" behavior Mojarra exposes in this case.

If this is good enough we can close this issue.
I would not change the identifier rendering behavior itself since Mojarra does not do it as well.


> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Commented: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867392#action_12867392 ] 

Werner Punz commented on MYFACES-2715:
--------------------------------------

Well I think the scripts are at fault here  as well not the renderer.
According to the spec of the issuing element is a dom not it must pass
(that also means a dom node without identifier)

The problem here is that
<h:commandLink onclick="alert('xxx');" />
renders into
<a href=".." onclick"alert('xxx');" />

I will fix the issue from my side, because I have clearly an error here, a form node is passed
and I run into a form could not be determined error, which is obviously a bug from my side.
Whether we need to enforce an id on such a component is another issue then.

Werner


> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Issue Comment Edited: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Werner Punz (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867475#action_12867475 ] 

Werner Punz edited comment on MYFACES-2715 at 5/14/10 7:13 AM:
---------------------------------------------------------------

ok I fixed this issue on my side be using also the event target as source for the issuer if the original issuer cannot be determined by the passed src element. This works well for me, and also follows the "undocumented" behavior Mojarra exposes in this case.

If this is good enough we can close this issue.
I would not change the identifier rendering behavior itself since Mojarra does not do it as well.

see also http://www.pastebin.org/236088 for my integration testcase
and https://issues.apache.org/jira/browse/MYFACES-2716 which is the issue under which my fix is committed together with a load of other stuff.


      was (Author: werpu):
    ok I fixed this issue on my side be using also the event target as source for the issuer if the original issuer cannot be determined by the passed src element. This works well for me, and also follows the "undocumented" behavior Mojarra exposes in this case.

If this is good enough we can close this issue.
I would not change the identifier rendering behavior itself since Mojarra does not do it as well.

  
> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Commented: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867694#action_12867694 ] 

Leonardo Uribe commented on MYFACES-2715:
-----------------------------------------

+1, I think we can close this issue too.

> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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


[jira] Commented: (MYFACES-2715) CommandLink didnt have id by default, will cause ajax problem

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867582#action_12867582 ] 

Jakob Korherr commented on MYFACES-2715:
----------------------------------------

Note that the id and name attributes of all ClientBehaviorHolder components are only rendered if they have a ClientBehavior attached (see MYFACES-2323 for details).

> CommandLink didnt have id by default, will cause ajax problem
> -------------------------------------------------------------
>
>                 Key: MYFACES-2715
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2715
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Mark Li
>
> <h:commandLink/>
> will output
> <a hre="#" onclick="om..."/>
> not id by default.
> I think it will cause ajax problem.
> suggestion:
> in HtmlLinkRendererBase.java
> should use  HtmlRendererUtils.writeIdAndName(writer, component, facesContext);(or other stuff can add id attribute)
> instead of 
> HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);

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