I have 2 drop down lists, once the user selects the first drop down it gets the list values of second drop down. But i need to save the values selected by the user from the 2 drop down lists when the page reloads and i m thinking of using session. Any help is appreciated.
If you are talking about page refresh, then you cannot control that using session on the server unless you use some sort of AJAX to send the currently selected drop down to the server. I had this kind of situation once and I used javascript to store the currently selected drop down as a hash in the URL. in the onLoad event of body tag, I called a method which extracted the value from the hash and pre-selected the drop down.
That's pretty straight-forward. Save the selection values in the session as scoped variables, then use JSP mechanisms on the page to set the selected attribute on the appropriate <option> elements. What part are you having problems with?
so i just need to have 2 session.setAttributes for 2 drop down lists, then in the struts action class access them, then how shall i add them in the options tag in jsp , since the inital value is set like this