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.
Store the data in hashmap or in an array list and iterate it for example use as in this way
Bean instance = (Instance of bean)arraylist.get(i);
//Store all the values in the bean and now close the scriptlet
//Put the code for select box like
<option value= <%=bean instance.get id %><%=bean intance.get required value&>
Hope you have understood
Joined: Aug 19, 2009
i am very new to this, so to be honest I dont understand,.
Let me put what i have done so far..
In my Class file
Vishal Pandya wrote:Gudim, Just above your post Bear mentioned that don't use Java code(Scriptlets) in JSP. JSTL and EL better alternatives.
I agree. Your JSP would be structured something like this:
This code assumes that some previous code, such as your MVC controller, placed a java.util.List in scope -- e.g., via request.setAttribute("mylist",aList); -- and also assumes that each list item has a "getProperty()" method.
To learn more, Google "JSP expression language" and "jstl".
In the code sample provided by Sunder Ganapathy for the dropdown, is there a posibility to pass locale from jsp to the DAO?
My database table is setup for different locales and I am currently working with something like this: ("select * FROM tablename WHERE tablename.locale='en_CA'")
I need the locale to change when user switches language. I am thinking of keeping locale in a session variable but not sure if it would be a good practice to specify session variable in the WHERE clause. Are there other better options?