This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Struts and the fly likes Where to populate values  for drop down box? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Where to populate values  for drop down box?" Watch "Where to populate values  for drop down box?" New topic

Where to populate values for drop down box?

Alan W. Smith

Joined: Sep 07, 2004
Posts: 13
Suppose I have two jsp pages login.jsp and page1.jsp. I also have the corresponding LoginForm and LoginAction mapped in my struts config file as the form bean and action, respectively. If the login succeeds then I want to go to page1.jsp. Also, I want to populate a drop down box in page1.jsp with values from a db. Where is the right place to retrieve these values from the db? And what is the right way of storing the values so that I can display them in a drop down box?

Raghavendra nandavar
Ranch Hand

Joined: Jun 26, 2005
Posts: 231
I think this thread will give some idea
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
This is how I would structure the flow:

1) The action would take the user to the login.jsp screen.
2) When the user clicked the submit button, the action would be called.
3) The "success" forward for that action would redirect to the action to show the main page:
<forward name="success" path="/" redirect="true" />
4) The code in the DisplayMain action would retrieve the list from the database and either store it on an ActionForm or put it in the request.

- Brent
I agree. Here's the link:
subject: Where to populate values for drop down box?
It's not a secret anymore!