0

Hello.

i wish to create a jsp page which will accept username and password from list and display a page showing the selected details when clicked on submit

<html>
<head><title>course information form
</title></head>
<body>
<form action="course_details.jsp" 

method="post">
username:
<select name="username">
<option>nikhil</option>
<option>avdhut</option>
<option>gauri</option>
</select>
<select name="course">
<option>MCA</option>
<option>MBA</option>
<option>MCM</option>
<input type="reset" name="reset" 

value="reset">
<input type="submit" name="submit" 

value="submit">
</form>
</body>
</html>

saved as html

<html>
<head><title><course information></title>
</head>
<body>
course details of students
<UL>
<LI> username<%=request.getParameter("username")%>
<LI>course<%=request.getParameter("course")%>
</UL>
</body>
</html>

saved as jsp

not working

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by javaAddict
1

This is what is displayed:

<option>[B]MCA[/B]</option>

This is what it is sent with the request:

<option value="[B]MCA[/B]">MCA</option>

Meaning that there will be cases that what you display is different from what you want to sent:
Example:

<select [B]name[/B]="product">
<option [B]value[/B]="000-001">Product Name 1</option>
<option [B]value[/B]="000-002">Product Name 2</option>
</select>

Remember that you send the value attribute at the request and you get it using the name. Like you did: request.getParameter("product") will return one of those: 000-001, 000-002. Not what is displayed between the "option" tags

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.