• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple question Redirect

 
Adam Teg
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am redirecting to a new page and passing the variables in the redirect. How can I capture it in the survey.jsp page?

response.sendRedirect("survey.jsp"+"?firstName="+firstName+"&lastName="+lastName+"&emailAddress="+emailAddress);

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"AdamSmith Smith",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Adam Teg
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't find my original user name and password.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for adjusting your display name.

Regardless of how your target page is arrived at -- a redirect, typing directly into the browser, a link on a page -- you would obtain the values of the request parameters with one of the getParameter family of methods on the request object.
 
Adam Teg
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

I have a response.sendRedirect that I append some values. Can I do a POST instead of the default GET.

response.sendRedirect("survey.jsp"+"?firstName="+firstName+"&lastName="+lastName+"&emailAddress="+emailAddress+"&didHeLie="+0);

Secondly, I still cannot get the variables on the survey.jsp using the response.getParameter(firstName);
What am I doing wrong?

Any help would be appreciated.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A redirect will always result in a GET.

Employ basic debugging techniques. First, is the URL in the address bar after the redirect well-formed?
 
Chris Brat
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the page that you redirect to try getting the parameters from the request, not the response.

Chris
 
Adam Teg
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again,

Can someone tell me what this error means?

org.apache.jasper.JasperException: business.User.(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String V

This is continued by a lot of:

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 
Adam Teg
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind my greenhorn friends. After starting tomcat things looked much better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic