Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

redirect but textfields value should not empty  RSS feed

 
deep raj
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have 2 textfield in a form in jsp page(a.jsp)
when i click on button it goes to another jsp page and check textfield1 value according to a condtion
if con. true then reurns to again previous page
so i used
response.sendRedirect("a.jsp");
but when it redirect to a.jsp the textfields are empty
i want to show textfields with fill values that i entered
how is that possible?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do one of the following:
  • Pass the text on the query string (not the best idea where you're talking about textareas which could have a lot of text)
  • Store the value of the text fields in session
  • Write the text to your database and read it again from the next JSP.





  •  
    deep raj
    Ranch Hand
    Posts: 186
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    ok i used string to store that textfield value
    but how can i fill textfield with that value when that page is reopen using response.sendRedirect
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Posts: 66205
    151
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Do you know HTML? Each form element has a value attribute.
     
    deep raj
    Ranch Hand
    Posts: 186
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    i know html
    i already set string value in textfield value.
    but at starting point string has null,so it sets textfield value null
    while value is stored in textfield which entered by user at run time.
     
    Christophe Verré
    Sheriff
    Posts: 14691
    16
    Eclipse IDE Ubuntu VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This is probably a forward that you want to do, not a redirect.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!