You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Kenneth Buvik (JIRA)" <de...@myfaces.apache.org> on 2007/07/16 13:28:04 UTC

[jira] Created: (TOMAHAWK-1056) With multiple commandlinks with same child-component id, tomahawk will always find the first commandlink's child component

With multiple commandlinks with same child-component id, tomahawk will always find the first commandlink's child component
--------------------------------------------------------------------------------------------------------------------------

                 Key: TOMAHAWK-1056
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1056
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Extended CommandLink/CommandButton
    Affects Versions: 1.1.6
         Environment: Linux Ubuntu Feisty Fawn 7.04, MyFaces 1.1.5, Facelets 1.1.11, ajax4jsf 1.1.1, richfaces 3.0.1
            Reporter: Kenneth Buvik
            Priority: Minor


 <ul id="language" style="float:right;">
                    <li>
                        
                        <t:commandLink id="changelocale_en" style="color:blue;" value="English" actionListener="#{profileBean.changeLocale}">
                            <f:param id="locale" name="locale_1" value="en"/>
                        </t:commandLink>
                    </li>
                    <li>
                        <t:commandLink id="changelocale_nb" style="color:blue;" value="Bokmål" actionListener="#{profileBean.changeLocale}">
                            <f:param id="locale" name="locale_2" value="nb"/>
                        </t:commandLink>
                    </li>
                    <li>
                        <t:commandLink id="changelocale_nn" style="color:blue;" value="Nynorsk" actionListener="#{profileBean.changeLocale}">
                            <f:param id="locale" name="locale_3" value="nn"/>
                        </t:commandLink>
                    </li>
                </ul>

This code works. however when finding child by ID, the child of the first t:commandlink returns.

        UIParameter param = (UIParameter) evt.getComponent().getChildren().get(0);
//        UIParameter param = (UIParameter) evt.getComponent().findComponent("locale"); // Always returns 
// the child of the first <t:commandLink

        String locale = String.valueOf(param.getValue());

        Locale loc = new Locale(locale);
        JSFUtil.getFacesContext().getViewRoot().setLocale(loc);

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


[jira] Commented: (TOMAHAWK-1056) With multiple commandlinks with same child-component id, tomahawk will always find the first commandlink's child component

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

Leonardo Uribe commented on TOMAHAWK-1056:
------------------------------------------

use the same id for different components is invalid, so the code of findComponent it is fine and it is not a problem with tomahawk. f:param could have the same name but always different id. This issue will be closed as invalid.

> With multiple commandlinks with same child-component id, tomahawk will always find the first commandlink's child component
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1056
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1056
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Extended CommandLink/CommandButton
>    Affects Versions: 1.1.6
>         Environment: Linux Ubuntu Feisty Fawn 7.04, MyFaces 1.1.5, Facelets 1.1.11, ajax4jsf 1.1.1, richfaces 3.0.1
>            Reporter: Kenneth Buvik
>            Priority: Minor
>
>  <ul id="language" style="float:right;">
>                     <li>
>                         
>                         <t:commandLink id="changelocale_en" style="color:blue;" value="English" actionListener="#{profileBean.changeLocale}">
>                             <f:param id="locale" name="locale_1" value="en"/>
>                         </t:commandLink>
>                     </li>
>                     <li>
>                         <t:commandLink id="changelocale_nb" style="color:blue;" value="Bokmål" actionListener="#{profileBean.changeLocale}">
>                             <f:param id="locale" name="locale_2" value="nb"/>
>                         </t:commandLink>
>                     </li>
>                     <li>
>                         <t:commandLink id="changelocale_nn" style="color:blue;" value="Nynorsk" actionListener="#{profileBean.changeLocale}">
>                             <f:param id="locale" name="locale_3" value="nn"/>
>                         </t:commandLink>
>                     </li>
>                 </ul>
> This code works. however when finding child by ID, the child of the first t:commandlink returns.
>         UIParameter param = (UIParameter) evt.getComponent().getChildren().get(0);
> //        UIParameter param = (UIParameter) evt.getComponent().findComponent("locale"); // Always returns 
> // the child of the first <t:commandLink
>         String locale = String.valueOf(param.getValue());
>         Locale loc = new Locale(locale);
>         JSFUtil.getFacesContext().getViewRoot().setLocale(loc);

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