struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Bergeron" <...@websidestory.com>
Subject RE: Form tags
Date Thu, 08 Mar 2001 01:38:49 GMT
Does anyone have any ideas about this?

-----Original Message-----
From: Brian Knorr [mailto:btk@nextjet.com]
Sent: Tuesday, March 06, 2001 12:16 PM
To: ted@websidestory.com
Subject: struts -- Form tags


Ted,

Hi... I was wondering if you ever heard anything back from the struts user
group on the "Form tags" issue you posted?  I was wondering the exact same
thing... especially for radio buttons.

Thanks,

Brian Knorr


NextJet! the leader in same day delivery.

-----Original Message-----
From: Ted Bergeron [mailto:ted@websidestory.com]
Sent: Wednesday, February 28, 2001 5:28 PM
To: Struts-User
Subject: Form tags


I'm wondering about the logic behind the form tags.  Here I have a simple
form that is created by iterating over a collection.  The iterator exposes
the variable "item" which is a String for this simple case.  The name
attribute of bean:write treats "item" as a variable, while the value
attribute of various form tags (radio, text, hidden) treats "item" as a
literal.  Thus, the "<%= item %>" workaround.  This workaround leads to code
that is not well formed xml, and becomes much uglier with a collection of
complex objects.

Am I using the framework incorrectly? Is this an oversight/bug?  Is this a
necessary behavior?

Thanks for the help,

Ted


<%    java.util.ArrayList list = new java.util.ArrayList();
list.add("First");
list.add("Second");
list.add("Third");
list.add("Fourth");
list.add("Fifth");
    pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
 %>

<html:form action="/test.do">
<table>
<logic:iterate id="item" name="list" type="java.lang.String">
    <tr>
    <td><html:radio property="username" value="item"/></td>

    <td><html:radio property="username" value="<%= item %>"/></td>

    <td><bean:write name="item"/></td>
    </tr>
</logic:iterate>
</table>
</html:form>



Mime
View raw message