You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org> on 2012/06/28 16:35:44 UTC

[jira] [Commented] (MYFACES-3577) Duplicate component Id Exception when binding variable in Session Scope

    [ https://issues.apache.org/jira/browse/MYFACES-3577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403138#comment-13403138 ] 

Mike Kienenberger commented on MYFACES-3577:
--------------------------------------------

I have received duplicate component id exceptions for this in Myfaces 1.1 or 1.2 when using facelets if I bind components to session-scoped beans, so this is not a change in behavior.

Note that if you only need a reference to your bound components and not dynamically create components, make sure you are returning "null" for the binding getter.

public UIComponent getMyComponent() { return null; }
public void setMyComponent(UIComponent c) { this.mycomponent = c; }

If you are using this pattern, you should be able to bind components to session-scoped beans without duplicate id warnings.   This works in Myfaces 1.2.   I will be testing in the next few days for 2.1 as I am starting a conversion of a project that uses this pattern today.

You still have to understand the issue mentioned by Leonardo, and make sure you are handling that situation.
                
> Duplicate component Id Exception when binding variable in Session Scope
> -----------------------------------------------------------------------
>
>                 Key: MYFACES-3577
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3577
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.1.5
>         Environment: Weblogic 10.3.4 server,Eclipse IDE,Windows xp,Java SE 6,
>            Reporter: Kumar Ashish
>            Assignee: Leonardo Uribe
>
> JSF specification JSF_20101108 mentions in its section 3.1.5 "It is strongly
> recommend that application developers place managed beans that are pointed at by component binding expressions in
> "request" scope, and not any other scope."
> My concerns are as follows:-
> 1) We are getting duplicate component id exception when using binding in a session scoped variable in myfaces 2.1.It is a well known issue.
> This is a "recommendation" for the developers but has been forced by the myfaces implementation.
> 2) JSF 1.2 and 1.1 implementations worked fine with the binding variables in session scope also.
> 3) The mojarra implementation does not enforces this.
> Please let me know if this issue will be taken up in future releases or myfaces is going to have the same implementaion from now on.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira