wood burning stoves 2.0*
The moose likes Struts and the fly likes list empty using s:select tag with Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "list empty using s:select tag with Struts 2" Watch "list empty using s:select tag with Struts 2" New topic
Author

list empty using s:select tag with Struts 2

anna lanzaro
Greenhorn

Joined: Nov 24, 2009
Posts: 8
I need help for a s:select tag

i have an action that execute a query that return a Collection:
In the jsp page I wrote:



This is the code of my action:


Students in implemented as below:

In the list I want see the Id_student of all my students.
when I execute my application there are no errors but my list is empty?What I can do?
Please help me!!!
thank you!


Rodrigo Bossini
Ranch Hand

Joined: Jul 03, 2009
Posts: 113
The list element should not be within {}. Also, the S in Students has to be in lower case so Struts can call the getters and setters properly.


I see wind mills
anna lanzaro
Greenhorn

Joined: Nov 24, 2009
Posts: 8
Rodrigo Bossini wrote:The list element should not be within {}. Also, the S in Students has to be in lower case so Struts can call the getters and setters properly.



if the list element is within {} I see this error

tag 'select', field 'list': The requested list key 'students' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
anna lanzaro
Greenhorn

Joined: Nov 24, 2009
Posts: 8
Please!!!
HELP ME!!!
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Did you actually try what Rodrigo said?? In the s:select tag, list="{Students}" should be list="students"...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
galne vaibhav
Greenhorn

Joined: Nov 30, 2009
Posts: 9
what you have to do is just get the value data from database put in hashmap or list and show on jsp in list attribute as mention below

JSP code:where objBussCode is my hashmap name

Edited by Dave to be legible.
anna lanzaro
Greenhorn

Joined: Nov 24, 2009
Posts: 8
I solved my problem!!
The problem was in the query not in the select tag!
Thanks
 
 
subject: list empty using s:select tag with Struts 2