You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Severtson <SS...@edutech.org> on 2003/03/13 16:09:06 UTC

nested:form parent scope

I'm using RC1, playing around with nested tag support, and ran into an unexpected behavior. I'm not sure if this is by design and I'm using it incorrectly, or a bug.

I'm iterating over a list of users, and want to create a short form for each user, containing their username and a submit button. However, I can't seem to refer to the bean created by the nested:iterate tag from within the nested:form scope. Jsp source code below.

How, from a nested:form, can I refer to a bean in the parent scope? As demonstrated below, "../" does not seem to work in this situation. Any suggestions? Workarounds? Help?

Thanks in advance,
--Scott Severtson


<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<jsp:useBean id="factory" scope="application" class="org.edutech.users.Factory"/>

<html>
<body>
    <table>
        <nested:iterate name="factory" property="users">
            <tr>
                <td>
                    <!-- Outputs username as expected -->
                    <nested:write property="userName"/>
                </td>
                <td>
                    <!-- Action references a form-bean named UserEditForm, who's implementation contains a userName property and get/setUserName methods -->
                    <nested:form action="/user/delete">
                        
                        <!--Output is empty, and refers to the UserEditForm, as expected -->
                        <nested:write  property="userName"/>

                        <!-- Output is empty, and still seems to refer to the UserEditForm -->
                        <nested:write property="../userName"/>
                        
                        <!-- Output produces a JspException when uncommented: -->
                        <!--   No getter method for property ../userName of bean UserEditForm -->
                        <!--nested:write property="../../userName"/-->
                        
                        <nested:submit property="submit"/>
                    </nested:form>
                </td>
            </tr>
        </nested:iterate>
    </table>
</body>
</html>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org