• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

forward values in jsp(see code)

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to pass the vars to another page to do something with them. I don't know how to forward the values to another page. Help!
<head>
<title>
direction
</title>
</head>
<%
String button = request.getParameter("button");
String table = request.getParameter("table");
String c_name = request.getParameter("c_name");
String [] kys = request.getParameterValues("pkey");
if (button == null) {
out.print("<html><head></head><body>Please go back and tell me what you want me to do!</body></html>");
}
else if (button.equals("Delete Checked Items")) {

}
%>
<body>
<%=button%><br><%=table%><br><%=c_name%><br>
<% for (int i=0; i<kys.length; i++)
System.out.println("The info is.....: " + kys[i]);
%>
</body>
</html>
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Get a reference to the requestDispatcher and then use that to forward the request. Just remember that you will not be able to send any output to the client.
ex. RequestDispatcher rs = getServletContext().getRequestDispatcher("path/servlet name")
rs.forward(yourrequestreference, yourresponsereference)


------------------
Bosun
SCJP for the Java� 2 Platform
 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
I'm using this in stead. Will it cause any problems?
String button = request.getParameter("button");
String table = request.getParameter("table");
String c_name = request.getParameter("c_name");
String [] kys = request.getParameterValues("pkey");
if (button == null) {
out.print("<html><head></head><body>Please go back and tell me what you want me to do!</body></html>");
}
else if (button.equals("Delete Checked Items")) { %>
<jsp:forward page="del.jsp" />
<jsp aram name="table" value=table />
<jsp aram name="c_cname" value=c_name />
<jsp aram name="kys" value=kys />
<%}%>
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic