This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Array of Beans in ActionForm does not retrieve any input
Martin Riedl
Greenhorn
Joined: Sep 06, 2003
Posts: 7
posted
0
I got the following problem: I created a Form for starting a query to the database with 8 different Criterias. I implemented the criterias as a seperate class (bean) with the properties 'from' and 'to' and 'displayName'. In my ActionForm i nest this criterias as an array of these classes. I pre-populate this array in my reset-method of the ActionForm ----code--- criterias = new QueryCriteria[allSorter.length];
for(int i = 0; i < allSorter.length; i++) { QueryCriteria crit = new QueryCriteria(); crit.setDisplayName(displayNames[i]); crit.setCritName(allSorter[i]); crit.setFrom(null); crit.setTo(null); criterias[i] = crit; } ---code--- allSorter is a String Array holding the criteria-types so i get an array of 8 QueryCriteriaObjects (e.G. vendornumber, date) in my jsp-page i iterate over this array to display the text-input-fields and render the display-name - all works fine. But by typing in some values in my text-fields and submitting the Form - the QueryCriteria-Properties 'From' and 'To' stay null. What's really strange is when populating in the reset-Method with setting 'From' and 'To' to e.g. 'Test' - this 'Test'-String is displayed in my Jsp-Form - so there has to be some kind of link to my object. Here's the part of my jsp-Page ----Code--- <logic:iterate id="result" name="QueryFormBean" property="criterias" type="istd.client.td.beans.QueryCriteria"> <bean:write name="result" property="displayName" /> <html:text property="from" name="result" size="20" /> <html:text property="to" name="result" size="20" /> </logic:iterate> ---Code--- I hope i was able to describe this precisely enough and anyone can help. Thanks
Martin Riedl
Greenhorn
Joined: Sep 06, 2003
Posts: 7
posted
0
sometimes it's very useful to read some older posts the Post 'This has to be easy!' handled a similar problem - i modified my code a bit and now it works - thanks
Mike Blair
Greenhorn
Joined: Sep 10, 2003
Posts: 19
posted
0
Originally posted by Martin Riedl: sometimes it's very useful to read some older posts the Post 'This has to be easy!' handled a similar problem - i modified my code a bit and now it works - thanks
That is my post, but im still a little fuzzy on this. I have yet to get this to work. Would you be interested in showing me your iterate tag and maybe some snippets of your bean class? Mike