File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Sturts Urgent query " Watch "Sturts Urgent query " New topic

Sturts Urgent query

Mukesh Kumar Yadav

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: 689


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"
value="%{country.countryId}" />

Nishan Patel.

Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
I agree. Here's the link:
subject: Sturts Urgent query
It's not a secret anymore!