This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hi I am creating a Webpage where user can select 12 Players names from drop down column and fill their other details and then "submit" to make database entries. I want to take the values and the drop down selections in arrays and make a database entry from other JSP page. can some one suggest how to take these values to other jsp page.
My first JSP: Here i am having two variable Stat_Player_name & U_RUNS which were used 12 times for storing player name & player runs.
Now this above form will display a same drop down lists 10 times. i want to select different options in these ten lists say like below:
List_1 Option: a
List_2 Option: d
List_3 Option: e
List_4 Option: b
List_5 Option: c
List_10 Option: d
Now i need that once user click the submit butten then the variable should be moved to "db_Match_Edit.jsp". Here i will have the code to catch the value as
But since all the 10 drop down options are getting catch by same select variable name "Stat_Match_name". So on "db_Match_Edit.jsp" i am only getting the last selected option in U_Stat_Match_name.
But i need all the 10 selected options in the "db_Match_Edit.jsp" jsp in an array.
Firstly, if you are new to JSP you need to know that you are doing it wrong from the start! You are using Java scriptlets in your JSP which have been obsolete and discredited for over 10 years. Please read this JspFaq entry. You should be using the JSTL and EL and not be putting any Java code in your JSPs.
Secondly, please UseCodeTags when posting code. Unformatted code is very hard to read.
Next, why are all the select options named the same? Give them different names if they represent different values. If they represent the same value, use the proper method for the request in your servlet to fetch the multiple values (search the javadoc for the available methods).
And, never ever name anything "submit" in your HTML. That's a reserved name. Change the name of the button immediately.
And finally, again, do not submit your form to a JSP. Ever. Submit it to a servlet. Always.