Hi Friends, I am having a problem, please help me .I want to run a query and display all the lastnames of all the users in my database.Here are my files:
My problem is what i need to do in my Action class,so that it sets the "users" variable properly and i would be able to read that variable in my jsp and display the lastname of all the users.I am tryin this but failing badly:
Please Please help,I would really appreciate your help. Thanks [ April 12, 2006: Message edited by: Bear Bibeault ]
He's just putting the bean in application scope rather than request scope. For a list that is the same for all users of the application it makes better sense than putting it in request scope.
When Struts tags are used in a JSP, they look for a bean in any scope, including application scope.
Joined: Jan 16, 2005
Thanks a lot friends,i was really stuck on that one and I got it solved,but I think I am not doing it the right way,please correct me:
This is the method in my utility class where i run the query and I doubt I am not doing it right here:
And I made this constructor in my viewForm class:
I do this in my Action class then:
And finally this in my jsp:
And it works,but i don't think I can keep adding constructors to my form class like that,and moreoever if I want to search by first name ,there would be a conflict between 2 constructors,so can someone please tell me the right way to do this.
Thanks Mick [ April 13, 2006: Message edited by: jas oberai ]