Forum Moderators: open

Message Too Old, No Replies

Passing select list value from one jsp to another

Paa box list item value to another jsp without using javascript

         

ywang

8:13 pm on Nov 17, 2003 (gmt 0)

10+ Year Member



Firstly, I am sorry if this question post in wrong place, but I can not find out which forum can get JSP isue support.

I have a list box in a .jsp.

<SELECT name="groupname">
<option value ="business">Business
<option value ="accounting">Accounting
....
</select>
<input type="submit" value="Names">

I need to send the selected group name to another .jsp. I don't know how to receive it or send it without using javascrip. I am using form method="post". I want to use String name= request.getParameter("groupname") like this way in my next .jsp.

How can I do it?

Thanks

garann

12:00 am on Nov 19, 2003 (gmt 0)

10+ Year Member



Hi ywang,

I'm not sure why you're having a problem. It may be as simple as a typo on the page that receives the form data. Here's the basics of what you should have:

The form


<form method="POST" action="secondJSP.jsp">
<SELECT name="groupname">
<option value ="business">Business
<option value ="accounting">Accounting
....
</select>
<input type="submit" value="Names">
</form>

"secondJSP.jsp"


<%@ page language="java"
session="true"
isThreadSafe="true"
contentType="text/html; charset=ISO-8859-1" %>
<% String name;
name = request.getParameter("groupname");
%>
<html>
...

If you don't see your problem from that example, maybe you can post your code? What is the error you're getting?

ywang

4:07 pm on Dec 18, 2003 (gmt 0)

10+ Year Member



Thank you very much, I got it.