You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nilesh <ve...@hotmail.com> on 2004/02/16 10:56:44 UTC

Retaining Textbox values even after form submit

In my Struts application I am implementing Search, It is working fine with the relevant results being displayed.
In the result page I again have the same SearchForm.
The user can search any number of times because he is always provided with SearchForm.
I want to retain (display ) the last searched text in the resultpage textbox.
Does Struts provide any facility for this or do I need to  use a bean or something like that.
Please suggest options.

Thanks in advance, for your interest in answering my question

Regards,
Nilesh.

Re: Retaining Textbox values even after form submit

Posted by Craig McClanahan <cr...@apache.org>.
Nilesh wrote:

>In my Struts application I am implementing Search, It is working fine with the relevant results being displayed.
>In the result page I again have the same SearchForm.
>The user can search any number of times because he is always provided with SearchForm.
>I want to retain (display ) the last searched text in the resultpage textbox.
>Does Struts provide any facility for this or do I need to  use a bean or something like that.
>Please suggest options.
>  
>
The simplest thing would be to make the form bean for your search form 
be in session scope instead of request scope -- then it will retain its 
field value(s) in between requests with no extra work.

>Thanks in advance, for your interest in answering my question
>
>Regards,
>Nilesh.
>
>  
>
Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Retaining Textbox values even after form submit

Posted by "Khalid K." <gr...@maikada.com>.
You can presist the "lastSearchTerm" in HttpSession and update your form
object with it.

In Action something like

If(session.getAttribute("lastSearchTerm") != null)
	myform.setSearchTerm((String)
session.getAttribute("lastSearchTerm"));


-----Original Message-----
From: Nilesh [mailto:verifyurcontact@hotmail.com] 
Sent: Monday, February 16, 2004 1:57 AM
To: Struts Users Mailing List
Subject: Retaining Textbox values even after form submit


In my Struts application I am implementing Search, It is working fine with
the relevant results being displayed. In the result page I again have the
same SearchForm. The user can search any number of times because he is
always provided with SearchForm. I want to retain (display ) the last
searched text in the resultpage textbox. Does Struts provide any facility
for this or do I need to  use a bean or something like that. Please suggest
options.

Thanks in advance, for your interest in answering my question

Regards,
Nilesh.

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org