Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem passing parameter with optionsCollection

 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I�m trying to show a select box but I just get a: "No getter method available for property rol for bean under name AdminForm" when trying to show the JSP page.
Problem is, the property rol is there...

This is the select box in the JSP


I pass the ArrayList listaRoles with setAttribute from the Action to the JSP. This ArrayList have a list of beans RolBean:

with his getter and setters.

The adminForm:


Can someone help with this? Thanks and sorry for my english
[ August 06, 2007: Message edited by: Mario Romero ]
 
Ranjit Gopinathan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is public getters/setters for rol defined in adminForm ?
 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I automatically generated them with eclipse.
 
Ranjit Gopinathan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that "name" attribute really required in the select tag, since it is already inside an html form?. Am not sure about if this is going to help or not.
 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know adminForm is optional, whenever I remove it in the select or the optionCollection it doesnt change anything (to my error I mean)
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the rol property is an array, you must specify multiple="true" in your html:select tag. For more information, see the heading select in this link.
 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! That worked. I though "multiple" referred to select more than one at the same time. Presupposing is one of the worst error one can�t debug.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mario Romero:
I though "multiple" referred to select more than one at the same time.

Actually, you're right -- multiple does mean that you can select more than one at a time. That's why it requires an array to hold the result. If you do not intend for the user to select more than one value, make rol an int or a String and remove the multiple="true" from your select tag. The important thing is that the tag and the property must be consisitent. If the property is an array, the tag must allow for multiple values to be selected. If the property is a single value, the tag must not allow for multiple values to be selected.
 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
..strange, the problem was with the array of "rol" in the ActionForm.

Whenever the select has multiple=true or not, rol must be an array or it won�t get the value, so I have to use rol[0] later.
Looks like I did something wrong but I checked the form getters and setters and I dont see anything bad.
At least is working, thanks again.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mario Romero:
Whenever the select has multiple=true or not, rol must be an array or it won�t get the value

I'm glad it's working, Mario, but the above statement simply isn't true. If you don't specify multiple="true" in an <html:select> the property can be a String or int, not an array and it will get populated just fine.
[ August 08, 2007: Message edited by: Merrill Higginson ]
 
Mario Romero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know it�s not logic, but that�s what I�m doing and works.
Perhaps something barely related with this is not right in some part of my code, but for the record, this is what I have actually:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic