This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Sturts Urgent query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sturts Urgent query " Watch "Sturts Urgent query " New topic
Author

Sturts Urgent query

Mukesh Kumar Yadav
Greenhorn

Joined: Sep 06, 2007
Posts: 2
I am using sturts and Hibernate and struts.
I am new to struts and Hibernate framework.I am trying to populate the combobox.but don't get any success yet.
I have a leftpannel filled with various links.I want, once I click one of these links,say productEntry link, a jsp pages get loaded which carries a combobox.This combobox get populated automatically from database.

could anyone help me out by giving me a sample code.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Do you know how to fetch data from database using Hibernate? If yes, then fetch the desired data and populate the combobox by iterating over it. logic:iterate tag of JSTL foreach tags will be helpful here.


My Blog
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Hi..

In your Action class first make one list which retrieve your combo box value like

private List<Country> countryList = getCountryList();

then jsp you can populate this country list using s:select like.

<s:select theme="simple" name="country.countryName"
list="countryList" listKey="countryName"
listValue="countryId"
value="%{country.countryId}" />


Thanks,
Nishan Patel.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sturts Urgent query
 
Similar Threads
Which Book should i Buy?
Spring Architecture help
Struts 2 in large Enterprise Projects
struts plugin for eclipse
Sturts in weblogic