• 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

page redirection with out losing values

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i had designed a page called s.jsp where i am entering the values in the text fields and as i enter the submit button the values are validated in check.java servletpage ,if the validation returns false the response has to be redirected to the s.jsp with out losing the values that i had entered first. but my values are lost . How can i retrieve this problem ? i should not lose my values.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Create a bean for input values on s.jsp.
In Servlet code, validate the properties, if they fails to validate , set the baen values to the previous value s coming from form.
Forward to s.jsp pages.

And use the EL for accessing request attribute values in JSP page, like

 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should do a forward, not a redirect. A redirect creates a new request, hereby dropping the originating request where the parameters/attributes are in.

You may find this article useful as well, it also handles validation in plain JSP/Servlet: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bauke Scholtz wrote:

You may find this article useful as well, it also handles validation in plain JSP/Servlet: http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html



And the above code I pasted is taken from the same article. Good Blog BalusC
 
There will be plenty of time to discuss your objections when and if you return. The cargo is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic