You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Deepa Khetan <de...@gmail.com> on 2006/01/28 10:43:22 UTC

Set values in form bean

Hi,

How can i set values to a form-bean before the form is submitted? I have
this form in session scope. When a user enters a particular field, another
hidden form gets submitted and the page is refreshed. The issue is i cannot
retain the values that the user has entered, after refresh. I guess, this is
because, the form itself is not getting submitted and so the values are not
set in the form.
Can anyone help me plz??
Deepa

Re: Set values in form bean

Posted by Hubert Rabago <hr...@gmail.com>.
If there's a form associated with a request, Struts automatically
populates the form bean for you. Just submit the form to a URL with a
proper form bean mapping, and struts will populate the form bean with
values from request parameters for parameters whose names match those
on the form.

It doesn't matter if the form you're submitting is hidden or not, or
if there isn't even an actual HTML form.  Even a GET /myPage.do?id=001
request, if mapped to an action mapping with an associated form, will
have its form populated for you by Struts.

Hubert

On 1/29/06, Deepa Khetan <de...@gmail.com> wrote:
> No, actually, its my requirement. When user enters a particualr field and
> leaves that textbox, i need to get some data from the database and display
> him that! So, i am sending the value in the textbox as a hidden parameter of
> another form and submitting it!
>
> Hope u got the real picture
>

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


Re: Set values in form bean

Posted by Debendra Barik <ba...@yahoo.com>.
Hello,
I think if you will use struts  lazyList then, it will takes care of previously entered data.
Thanks,
Debendra.

Deepa Khetan <de...@gmail.com> wrote: No, actually, its my requirement. When user enters a particualr field and
leaves that textbox, i need to get some data from the database and display
him that! So, i am sending the value in the textbox as a hidden parameter of
another form and submitting it!

Hope u got the real picture


On 1/28/06, Debendra Barik  wrote:
>
> Hi,
> Plz. let me know about  you wrote "When a user enters a particular field,
> another
> hidden form gets submitted and the page is refreshed." . Whether you are
> doing so by writing some code(its your requirement) or you just guess its
> happening automatically when a user enter a particular field, so its not
> letting you to populate your form bean with the user input. Its not giving a
> clear picture. If one of them is an issue for you, then plz. send the code
> of your jsp pages, so i will try my best to help you out.
> Thanks,
> Debendra.
>
> Deepa Khetan  wrote:
> Hi,
>
> How can i set values to a form-bean before the form is submitted? I have
> this form in session scope. When a user enters a particular field, another
> hidden form gets submitted and the page is refreshed. The issue is i
> cannot
> retain the values that the user has entered, after refresh. I guess, this
> is
> because, the form itself is not getting submitted and so the values are
> not
> set in the form.
> Can anyone help me plz??
> Deepa
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> With a free 1 GB, there's more in store with Yahoo! Mail.
>



				
---------------------------------
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with your Yahoo! Mail.

Re: Set values in form bean

Posted by Deepa Khetan <de...@gmail.com>.
No, actually, its my requirement. When user enters a particualr field and
leaves that textbox, i need to get some data from the database and display
him that! So, i am sending the value in the textbox as a hidden parameter of
another form and submitting it!

Hope u got the real picture


On 1/28/06, Debendra Barik <ba...@yahoo.com> wrote:
>
> Hi,
> Plz. let me know about  you wrote "When a user enters a particular field,
> another
> hidden form gets submitted and the page is refreshed." . Whether you are
> doing so by writing some code(its your requirement) or you just guess its
> happening automatically when a user enter a particular field, so its not
> letting you to populate your form bean with the user input. Its not giving a
> clear picture. If one of them is an issue for you, then plz. send the code
> of your jsp pages, so i will try my best to help you out.
> Thanks,
> Debendra.
>
> Deepa Khetan <de...@gmail.com> wrote:
> Hi,
>
> How can i set values to a form-bean before the form is submitted? I have
> this form in session scope. When a user enters a particular field, another
> hidden form gets submitted and the page is refreshed. The issue is i
> cannot
> retain the values that the user has entered, after refresh. I guess, this
> is
> because, the form itself is not getting submitted and so the values are
> not
> set in the form.
> Can anyone help me plz??
> Deepa
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> With a free 1 GB, there's more in store with Yahoo! Mail.
>

Re: Set values in form bean

Posted by Debendra Barik <ba...@yahoo.com>.
Hi,
  Plz. let me know about  you wrote "When a user enters a particular field, another
hidden form gets submitted and the page is refreshed." . Whether you are doing so by writing some code(its your requirement) or you just guess its happening automatically when a user enter a particular field, so its not letting you to populate your form bean with the user input. Its not giving a clear picture. If one of them is an issue for you, then plz. send the code of your jsp pages, so i will try my best to help you out.
  Thanks,
  Debendra.

Deepa Khetan <de...@gmail.com> wrote:
  Hi,

How can i set values to a form-bean before the form is submitted? I have
this form in session scope. When a user enters a particular field, another
hidden form gets submitted and the page is refreshed. The issue is i cannot
retain the values that the user has entered, after refresh. I guess, this is
because, the form itself is not getting submitted and so the values are not
set in the form.
Can anyone help me plz??
Deepa
  


		
---------------------------------
Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.