• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

response.sendRedirect

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you Ankit and Bear
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic