You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Manisha Sathe <ma...@yahoo.com> on 2005/01/11 03:49:55 UTC
Edit Form - populate values from database
I have Add/Edit/Delete for one database table.
For Edit what i want is to get the values from database and display it on form as default.
What i am doing is ->
1)First calling one action handler getting the values from database and putting inside one data bean. Putting that bean inside request scope then forwarding to Edit Form
2)Inside Edit form I want to get these values as by default for text box
I tried something <html:text property="oddsno" value=????> many different combination using cout / html:bean... etc etc but i am not getting the values.
Is there any good solution for getting default values inside Edit Form?
regards
Manisha
---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! � Try it today!
Re: Edit Form - populate values from database
Posted by Manisha Sathe <ma...@yahoo.com>.
Thanks to all, Now i could manage to get the things working properly.
regards
Manisha
---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
Re: Edit Form - populate values from database
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "Manisha Sathe" <ma...@yahoo.com>
> For Edit what i want is to get the values from database and display it on
> form as default.
> What i am doing is ->
> 1)First calling one action handler getting the values from database and
> putting inside one data bean. Putting that bean inside request scope then
> forwarding to Edit Form
> 2)Inside Edit form I want to get these values as by default for text box
Rather than putting your bean in request scope, populate the form bean
before forwarding to EditForm. The easiest way is with
BeanUtils.copyProperties() [assuming the property names match]. You can see
an example of this in struts-example.war.
Using the 'value' attribute (or nested <bean:write> tag) means that the form
will always be rendered with the values from the database-- this could be a
problem if you need to validate the form and re-display the incorrect input.
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:hidden query
Posted by Kishore Senji <ks...@gmail.com>.
<html:hidden name="myBean" property="myProperty"/>
Note that <html:text property="myField"/> is just enough to populate
the text box. The <bean:write/> in the body of <html:text/> doesn't do
anything.
On Wed, 12 Jan 2005 23:34:27 -0800 (PST), Manisha Sathe
<ma...@yahoo.com> wrote:
> Following i could get it but now i want this inside html hidden form tag.
>
> <html:text property="myField" >
> <bean:write name="myBean" property="myProperty" />
> </html:text>
>
> But If i use hidden tag then gives me error saying hidden can not have value. How can i put my bean data in <html:hidden> ?
>
> regards
> Manisha
>
> Janarthan Sathiamurthy <ja...@yahoo.com> wrote:
> Hi,
>
> If you have a bean by name myBean in request scope, a property of the bean by name myProperty can be displayed in the jsp page by -
>
> Best Regards,
> Janarthan S
>
> Manisha Sathe wrote:
> I have Add/Edit/Delete for one database table.
>
> For Edit what i want is to get the values from database and display it on form as default.
>
> What i am doing is ->
> 1)First calling one action handler getting the values from database and putting inside one data bean. Putting that bean inside request scope then forwarding to Edit Form
> 2)Inside Edit form I want to get these values as by default for text box
>
> I tried something many different combination using cout / html:bean... etc etc but i am not getting the values.
>
> Is there any good solution for getting default values inside Edit Form?
>
> regards
> Manisha
>
>
> ---------------------------------
> Do you Yahoo!?
> Meet the all-new My Yahoo! – Try it today!
>
> ---------------------------------
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
>
> ---------------------------------
> Do you Yahoo!?
> All your favorites on one personal page – Try My Yahoo!
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
html:hidden query
Posted by Manisha Sathe <ma...@yahoo.com>.
Following i could get it but now i want this inside html hidden form tag.
<html:text property="myField" >
<bean:write name="myBean" property="myProperty" />
</html:text>
But If i use hidden tag then gives me error saying hidden can not have value. How can i put my bean data in <html:hidden> ?
regards
Manisha
Janarthan Sathiamurthy <ja...@yahoo.com> wrote:
Hi,
If you have a bean by name myBean in request scope, a property of the bean by name myProperty can be displayed in the jsp page by -
Best Regards,
Janarthan S
Manisha Sathe wrote:
I have Add/Edit/Delete for one database table.
For Edit what i want is to get the values from database and display it on form as default.
What i am doing is ->
1)First calling one action handler getting the values from database and putting inside one data bean. Putting that bean inside request scope then forwarding to Edit Form
2)Inside Edit form I want to get these values as by default for text box
I tried something many different combination using cout / html:bean... etc etc but i am not getting the values.
Is there any good solution for getting default values inside Edit Form?
regards
Manisha
---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! � Try it today!
---------------------------------
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
---------------------------------
Do you Yahoo!?
All your favorites on one personal page � Try My Yahoo!
Re: Edit Form - populate values from database
Posted by Janarthan Sathiamurthy <ja...@yahoo.com>.
Hi,
If you have a bean by name myBean in request scope, a property of the bean by name myProperty can be displayed in the jsp page by -
<html:text property="myField" >
<bean:write name="myBean" property="myProperty" />
</html:text>
Best Regards,
Janarthan S
Manisha Sathe <ma...@yahoo.com> wrote:
I have Add/Edit/Delete for one database table.
For Edit what i want is to get the values from database and display it on form as default.
What i am doing is ->
1)First calling one action handler getting the values from database and putting inside one data bean. Putting that bean inside request scope then forwarding to Edit Form
2)Inside Edit form I want to get these values as by default for text box
I tried something many different combination using cout / html:bean... etc etc but i am not getting the values.
Is there any good solution for getting default values inside Edit Form?
regards
Manisha
---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! � Try it today!
---------------------------------
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.