You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Mick Knutson <mi...@gmail.com> on 2008/05/07 07:21:21 UTC

commandLink navigation issue

I have an issue selecting a row from a dataTable. I have use html, and
tomahawk but no luck:

                            <h:dataTable rendered="#{userForm.users.rowCount
> 0}"
                                         value="#{userForm.users}"
                                         var="user"
                                         columnClasses="subtitle,medium"
                                         rowClasses="rowA,rowB">
                                <h:column>
                                    <f:facet name="header"><h:outputText
value="First Name"/></f:facet>
                                    <h:outputText
value="#{user.firstName}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header"><br /></f:facet>
                                    &#160;
                                    *<h:commandLink
action="#{userForm.prepareForEdit}"
                                                   value="Edit"
                                                   immediate="true"/>*
                                    &#160;
                                    <h:commandLink
action="#{userForm.delete}"
                                                   immediate="true">
                                        <h:outputText value="Delete"/>
                                    </h:commandLink>
                                </h:column>
                            *</h:dataTable>*
                        </h:panelGrid>
                    </h:form>
                </f:view>
                <p><h:form><h:commandLink
action="#{userForm.prepareForEdit}"
                                  value="Edit"
                                  immediate="true"/></h:form>
                </p>


The color in red will submit, but I get an NPE because there is no user
selected. The yelow highligh just returns back to the same form itself.


Here is my faces-config section:

    <navigation-rule>
        <from-view-id>/view/admin/index.xhtml</from-view-id>
        <navigation-case>
            <from-action>#{userForm.list}</from-action>
            <to-view-id>/view/admin/listUsers.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>/view/admin/listUsers.xhtml</from-view-id>
        <navigation-case>
            <from-action>#{userForm.prepareForEdit}</from-action>
            <from-outcome>editProfile</from-outcome>
            <to-view-id>/view/member/user.xhtml</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-action>editProfile</from-action>
            <to-view-id>/view/member/user.xhtml</to-view-id>
        </navigation-case>
    </navigation-rule>


And my bean meathod debug does not get called:

    public String prepareForEdit() throws Exception {

        if (log.isDebugEnabled()) {
            log.debug("Entering 'prepareForEdit' method");
        }

        user = (User) usersDataModel.getRowData();




-- 
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.linkedin.com/in/mickknutson
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---