Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

struts indexed form elements not getting into form bean

Thread view: 
apaeth@fortdearborn.com - 06 Jan 2006 22:25 GMT
I'm using struts 1.2.7 and I've got what seems like should be a rather
simple task to complete.  I've got a form that lists an arbitrary
number of items in rows.  I'm iterating through a collection to
generate this list, so I'm using the indexed attribute on all the html
elements.

<html:form action="/DoFileStuff">
...
<logic:iterate id="file" name="folder" property="newFiles"
type="foo.FileLister">
...
<html:text name="fileStuffForm" property="extinfo" indexed="true"/>
...
</logic:iterate>
...
</html:form>

the text box gets the name "fileStuffForm[0].extinfo" which I believe
is correct.  The struts config for this form looks something like this.

       <form-bean name="fileStuffForm"  dynamic="true" >
           <form-property name="extinfo" type="java.lang.String[]" />
       </form-bean>
       ...
       <action path="/DoFileStuff"
           name="fileStuffForm"
           type="foo.ProcessFileRequestAction">
           <forward name="success" path=".view.Files"/>
       </action>

I've discovered that the property name in the DynaValidatorForm ends up
being extinfo and it shows that it contains a String[], but the array
always ends up being empty.  I know that this works correctly using a
non-indexed html element and I'd just switch to getting the values
directly out of the request since I know what the name is, but I want
to be able to use the validation built into the form.

Thanks in advance for any help,
A Paeth
Tim B - 07 Jan 2006 21:29 GMT
> I'm using struts 1.2.7 and I've got what seems like should be a rather
> simple task to complete.  I've got a form that lists an arbitrary
[quoted text clipped - 6 lines]
> <logic:iterate id="file" name="folder" property="newFiles"
> type="foo.FileLister">

I had a similar problem, although not with a dynamform. The fix was to give
the id and property the same value

> <html:text name="fileStuffForm" property="extinfo" indexed="true"/>
> ...
[quoted text clipped - 4 lines]
> the text box gets the name "fileStuffForm[0].extinfo" which I believe
> is correct.

shouldn't this be fileStuffForm.extinfo[0] ?

>The struts config for this form looks something like this.
>         <form-bean name="fileStuffForm"  dynamic="true" >
[quoted text clipped - 16 lines]
> Thanks in advance for any help,
> A Paeth


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.