This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.