You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by yanming lu <lu...@hotmail.com> on 2002/04/04 15:43:24 UTC

how to add data into a form?

Here is what i'd like to do:

page 1 has form with ID and NAME. The NAME field is hidden so it is blank. 
This form is configured as a java bean and set in the struts-config.xml 
file.

when user click the 'save' button, the id of the form is carried to next 
page, page 2. But in the between, I look at the dababase and find the name 
base on this id and call the setNAME() function to set the name value in the 
same form. But this NAME does not appear on the second form. Why?

yan

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: how to add data into a form?

Posted by Ted Husted <hu...@apache.org>.
Depending on the workflow, the ActionServlet may be calling reset and
repopulating the bean from the request. If this is what is happening,
one solution is to add a mutable property to the ActionForm, to tell the
setters to ignore additional input. See 

http://cvs.apache.org/viewcvs/jakarta-struts/contrib/scaffold/src/framework/main/org/apache/scaffold/http/SuperForm.java

for an example.

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


yanming lu wrote:
> 
> Here is what i'd like to do:
> 
> page 1 has form with ID and NAME. The NAME field is hidden so it is blank.
> This form is configured as a java bean and set in the struts-config.xml
> file.
> 
> when user click the 'save' button, the id of the form is carried to next
> page, page 2. But in the between, I look at the dababase and find the name
> base on this id and call the setNAME() function to set the name value in the
> same form. But this NAME does not appear on the second form. Why?
> 
> yan
> 
> _________________________________________________________________
> Join the world’s largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>