i have a simple PRogram that can display/add/delete/edit the value from the database.. in my homePage.jsp i have one DropDown Menu this is filter the record.. my problem is in my AddRecord.jsp. because if a user select a value on the DropDown Menu ex. PAGE-1 and click ADD button, what i want to do is to display on the DROPDOWN is the SELECTED value of PAGE-1. but its not working instead when i SELECT PAGE-1 from the DropDown and Click ADD button, the value of dropdown in AddRecord that jsp will be back to empty which the user need to select the value again..
this for quick understanding..hope so...
ex. i have a car collection program. which is categorized according to brand name. and if i select the brand FERARI and i want to add new car in this category.. it will automatically display my selected FERARI then add the new can to it.....
honestly i dont get it.. as i've said im just a pure newbie in jsp.. so its sounds like chinese to me..
here is my code..
on that.. when i select a value on the dropdown, and click ADD.. it will display the nextpage which is InsertReport.jsp
what i want is..when i select a value a value of dropdown in HomePAge.jsp and click ADD what i want to see in the next page is the SELECTED VALUE FROM HomePage.jsp is Display to InsertReport.jsp automatically..
As a novice to JSP it's important that you learn JSP correctly and you're on a very bad track.
After the introduction of JSP2 in 2002 -- yes, 10 years ago - putting Java code, and especially database code, into a JSP is considered an unacceptable practice. It still exists for compatibility with legacy applications, but any JSP written after 2002 should be using the JSTL (JSP Standard Tag Library) and EL (Expression Language) in place of Java scriptlets.
I'd also recommend reading the following articles:
But what it comes down to is as easy as this: if you want a particular option in the drop down to be selected, you put the selected attribute on the option. For example:
<option value="whatever" selected>Whatever!</option>
Frequently the EL's ternary operator is useful for this. For example:
subject: Display the Selected DropDown Value to another JSP Page