This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP redirection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP redirection" Watch "JSP redirection" New topic

JSP redirection

Nick Verma

Joined: Oct 27, 2004
Posts: 9

I have two drop down boxes and depending on the value selected the appropriate jsp page should be loaded. I am wrong somewhere. Please let me know where I am wrong.
<form method = "post" action = "servers.jsp">
<select name="superbapi1">
<option name="server1" value = "temp1" />
<option name="server1" value = "temp2" />
<input type = "submit" value = "Submit" />
<select name="superbapi2">
<option name="server2" value = "temp1" />
<option name="server2" value = "temp2" />
<input type = "submit" value = "Submit" />
String name1 = request.getParameter("server1");
String name2 = request.getParameter("server2");
<jsp:forward page = "status_sb1.jsp?server=temp1"%>

<jsp:forward page = "status_sb1.jsp?server=temp2" %>
<jsp:forward page = "status_sb2.jsp?server=temp1" %>
<jsp:forward page = "status_sb2.jsp?server=temp2" %>

Thanks for your help.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63348

Perhaps some insight on what "I am wrong somewhere" means would help?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 364
You need to look for the name of the select box, not the name of the option. Your request params are null here...

No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
I agree. Here's the link:
subject: JSP redirection
It's not a secret anymore!