File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

list empty using s:select tag with Struts 2

 
anna lanzaro
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
anna lanzaro
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please!!!
HELP ME!!!
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you actually try what Rodrigo said?? In the s:select tag, list="{Students}" should be list="students"...
 
galne vaibhav
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved my problem!!
The problem was in the query not in the select tag!
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic