aspose file tools*
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 8 in Action this week in the Java 8 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
Author

Where to populate values for drop down box?

Alan W. Smith
Greenhorn

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?

Thanks!
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 DisplayLogin.do would take the user to the login.jsp screen.
2) When the user clicked the submit button, the action ProcessLogin.do would be called.
3) The "success" forward for that action would redirect to the action to show the main page:
<forward name="success" path="/DisplayMain.do" 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: http://aspose.com/file-tools
 
subject: Where to populate values for drop down box?
 
Similar Threads
populating drop down box
Getting the selected drop down value in the next page
Dynamic Drop down based on another value in the same form
How to populate drop down box
Populating 'html:select' with values in Database