my dog learned polymorphism*
The moose likes Struts and the fly likes html:select indexed - idexes the formbean i.s.o. the property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:select indexed - idexes the formbean i.s.o. the property" Watch "html:select indexed - idexes the formbean i.s.o. the property" New topic
Author

html:select indexed - idexes the formbean i.s.o. the property

Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
Hi all,

I already searched the forum for comparable topics, but in none of them was a solution available.

I'm generating an indexed selectbox for every item in a list (of users). By doing this I want to be able to "evaluate" every user according to the selected values from their respective selectbox.
So far I am able to generate the select boxes, but somehow it doesn't see the property (for the selectbox) as the indexed attribute. The followinng code generates the required list with the selectboxes.

The only problem is that the selectboxes are not correctly indexed. Normally you would expect something like this:
html:select property="formbean.evalId[i]" where evalId contains the index number.
But what I get is html:select property="formbean[0].evalId" where in this case the formbean itself gets indexed.
I implemented the property in the formbean as well as a String[] as a List but I haven't solved the problem yet.
Any ideas on this?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

<bean:define name="formbean" property="evalId" id="evalId"/>
<c:forEach....
...
<html:select name="evalId" indexed="true">
...


A good workman is known by his tools.
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
Originally posted by Marc Peabody:
<bean efine name="formbean" property="evalId" id="evalId"/>
<c:forEach....
...
<html:select name="evalId" indexed="true">
...


Thanks for your reply Marc. One problem: html:select property is required attribute. so what do I put there then?

Update:
When I use nested tag for selectbox, it's getting rendered as <select name="evalId"> where evalId gets filled with all the values gathered from all the selectboxes that are generated. So this way I can go further.
And the problem I had with indexed formbean appears to be the normal outcome when using indexed selectbox. The question remains on getting the data if it's supposed to be that way (since evalId returns null).
[ September 29, 2005: Message edited by: Ergin Er ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:select indexed - idexes the formbean i.s.o. the property
 
Similar Threads
doesnt display struts tags in normal html form
error in form display?
<html:select>box validation
Problem in Creating Dynamic Link from Display Table
using ajax and struts iterate tags