This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect

 
bharani rao
Ranch Hand
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this article can help you learn how to properly structure modern web applications.
 
bharani rao
Ranch Hand
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Ankit and Bear
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic