| Author |
problem sendRedirect to JSP page
|
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
Hi,
I am having problems in sendind Re-direct to JSP page .
I am able to get the datas displayed in the servlet ,, bu no idea of redirecting it to JSP page ...fresher in JSP and Servlets
My codings for sevlet is as follows:-
now I want o get all these seven fields to be displayed in a jsp file (users.jsp),, please give me some guidelines to do this .
How to pass the above values in the jsp file.
as my users.jsp file is having errors ..
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
A few points:
You are doing a forward, not a redirect. They are not the same. In this case, a forward is correct.The logic in your servlet is such that the values are being over-written on each loop. At the end of the loop all you have is the data from the last iteration. Ths is certainly not your intention.To make the data available to a forwarded JSP, you create scoped variables in the request. You do this with request.setAttribute().In your JSP, be sure to avoid old-fashioned scriptlets and use modern mechanisms such as the JSTL and EL.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
hi,
Thankyou . I will try this and let you know.
Regards
|
 |
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
hi,
my error is like this now :-
I could not figure out , how i have used the duplicationn of the local variable user
:- User is a class file which having getter methods returning the values; and " users" is the attribute which was setted.
Regards
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
So I see that you ignored my advice not to use scriptlets.
|
 |
Ilya Cyclone
Greenhorn
Joined: Feb 28, 2010
Posts: 4
|
|
Hi Thamu,
in yout JSP there should be smth like:
|
 |
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
Hi Ilya and Bear ,
Sorry for using the scriplets , and thankyou for your logic
And thankyou Ilya for giving me that hint.
Now its done .
Regards ,
|
 |
 |
|
|
subject: problem sendRedirect to JSP page
|
|
|