• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where to populate values for drop down box?

 
Alan W. Smith
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this thread will give some idea
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic