Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dropdown list in jsp

843836Sep 8 2004 — edited Aug 19 2007
Hi -

I need some help.Here is my problem. I am writing drop down list in the jsp. I need to get the value of dropdown list and submit the form and again calling same jsp page. So i didn't see the same value in the
dropdown list whichever i was submitting.its giving some javascript errors.I really appreciate if anyone resolves this problem or valuble suggestions.



<script language="JavaScript">
function messageValue(){

<%
String id = request.getParameter("id");
if (id != null)
{
%>
document.myForm.id.value = <%=id%>
document.myForm.submit();
<%
}
else {
%>
var messageIndex = document.myForm.id.selectedIndex;
var selectedValue = document.myForm.id.options[messageIndex].value;
document.myForm.id.value = selectedValue;
document.myForm.submit();
<% } %>
}
</script>
<select name="id" onChange="messageValue()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2007
Added on Sep 8 2004
9 comments
581 views