wood burning stoves 2.0*
The moose likes JSP and the fly likes response.sendRedirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "response.sendRedirect" Watch "response.sendRedirect" New topic
Author

response.sendRedirect

bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

i'm running a html page which collects students' details( a.html).
when i submit it , it it should process the total average in b.jsp.

i was able to do that.
but the b.jsp should redirect the page to c.jsp where it should print the result.

i was able to redirect to c.jsp.

i used response.sendRedirect("c.jsp");

now it is showing error in the c.jsp.

this is c.jsp file.




the error is




this is b.jsp





where am i missing...
please help.

thanks in advance
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

Buddy you are using a very bad programming style. First of all, you said that your b.jsp is doing total/average but I don't see anything like that there. Secondly, If you redirect the user from b.jsp to c.jsp, then the values of variables in b.jsp will not be preserved. And doing business logic in JSPs is not a good practice. You should use a servlet instead of b.jsp. That servlet will calculate the total and average and then forward the request using RequestDispatcher to c.jsp. That servlet will also store the total and average as request attributes for c.jsp to retrieve and display. Please try to do this and ask any confusions...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Perhaps this article can help you learn how to properly structure modern web applications.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
thank you Ankit and Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response.sendRedirect
 
Similar Threads
Re: Urgent with this program, Pls help
Read input,but got error
validation for numbers and alphabets
Problem in output
Pls help on this read Input