On my first
JSP page, I have few picklist box like "Item", "Price Range", "Brand Name", etc. After user makes choices, I will call a
servlet to search the database based on what user selected, then return with the invoice list, but I want to keep the "Item", "Price Range", "Brand Name" at where they are and the default selection for each picklist should be what user just selected. In this way, user can change their selection and then click "Get Result" button and it should return the new result, that's it. Looks simple. But my question is --
1. If I create a JSP page including these picklists, and then it calls the servlet, then the servlet forward to another JSP (or the same JSP) including the new invoice part, then how can the second JSP change its default selction for each picklist ? It seems impossible.
2. I can create a helper class to dynamically create this picklist HTML part, in other words, I use this class to generate the "<OPTION VALUE=.., SELECTED>" dynamically, and output this whole
string to the JSP page. This works but I am wondering if there is better way to do it.
Thanks.