• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP redirection

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

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.
<HTML>
<BODY>
<form method = "post" action = "servers.jsp">
<h3>SUPER-1</h3><br/>
<select name="superbapi1">
<option name="server1" value = "temp1" />
<option name="server1" value = "temp2" />
<input type = "submit" value = "Submit" />
</select>
<h3>SUPER-2</h3><br/>
<select name="superbapi2">
<option name="server2" value = "temp1" />
<option name="server2" value = "temp2" />
<input type = "submit" value = "Submit" />
</select>
</form>
<%
String name1 = request.getParameter("server1");
String name2 = request.getParameter("server2");
if(name1="temp1"){
%>
<jsp:forward page = "status_sb1.jsp?server=temp1"%>
<%
}
%>

<%
if(name1="temp2"){
%>
<jsp:forward page = "status_sb1.jsp?server=temp2" %>
<%
}
%>
<%
if(name2="temp1"){
%>
<jsp:forward page = "status_sb2.jsp?server=temp1" %>
<%
}
%>
<%
if(name2="temp2"){
%>
<jsp:forward page = "status_sb2.jsp?server=temp2" %>
<%
}
%>
</BODY>
</HTML>

Thanks for your help.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps some insight on what "I am wrong somewhere" means would help?
 
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to look for the name of the select box, not the name of the option. Your request params are null here...
 
reply
    Bookmark Topic Watch Topic
  • New Topic