This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect  RSS feed

 
bharani rao
Ranch Hand
Posts: 164
  • 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: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 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
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Ankit and Bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!