I have one index page in my site where the user has to verify himself with name and password, then this information is passed to a servlet which matches the same against a database. From here I want to transfer the request to a JSP with response.sendRedirect() method. The JSP page is called but request parameters are not available here. How caN i make request parameters available in this page also?
James Long
Greenhorn
Joined: Feb 02, 2001
Posts: 14
posted
0
You need to do the following: (1). In servlet: ----- request.setAttribute("YourParameter"); --- getServletConfig().getServletContext().getRequestDispatcher("YourJspPageReativeURL").forward(req,res); (2). In JSP: String parameter = request.getAttribute("YourParameter"); ...... I hope it will help you! Good Luck
Raghav Mathur
Ranch Hand
Joined: Jan 12, 2001
Posts: 639
posted
0
the code : <% response.sendRedirect(" the iurl where you wanna go"); %>
Raghav.
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
posted
0
Raghav, I think you missed the point -- request parameters normally don't survive a redirect. Of course you can add parameters to a redirect, as to any request: response.sendRedirect("http://url/page.jsp?parameter=blah"); But in this case it looks like a forward is more appropriate. - Peter
sachin sachdeva
Greenhorn
Joined: Mar 13, 2001
Posts: 14
posted
0
When we uses sendredirect then it does not passe the values to next page.For this either u can use forward or sendRedirect("uri+querystring) Means by only querystring u can pass the values in sendRedirect