struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy.de" <a.schm...@best-blu.de>
Subject Re: Init of forms
Date Wed, 27 Sep 2006 08:23:15 GMT

Thx Yamir,
this was the hint i needed, all is workig well now.
Regards, Andy
 

Yamir Encarnacion wrote:
> 
> Take a look at http://struts.apache.org/1.1/faqs/newbie.html#prepopulate
> (How can I prepopulate a form?)
> I believe that the struts-example.war example application that is shipped    
> with Struts 1.1 has the code for doing what you want.  I believe that you
> want to look at the editRegistration action in the example.
> You can get struts 1.1 from
> http://archive.apache.org/dist/struts/struts-1.1/
> Yamir
> ----- Original Message ----
> From: Andy.de <a.schmidt@best-blu.de>
> To: user@struts.apache.org
> Sent: Tuesday, September 26, 2006 5:13:12 PM
> Subject: Re: Init of forms
> 
> 
> Hi Antonio,
> i do not understand. The action is executed if the form is submitted, this
> is
> after the jsp has been displayed. I want to fill the form with values from
> database
> before the jsp is displayed.
> I need the typical 'edit' function, not create.
> Regards, Andy
> 
> 
> apetrelli wrote:
>> 
>> Ilja S. ha scritto:
>>> Hi
>>> Action class is right place.
>>> Common way is to have some layer working with DB like DAO pattern. 
>>> Then You can have some service layer between DAO and Action which you 
>>> call from Action class.
>>> Call it, get data transfer object from DB, copy its properties to 
>>> ActionForm instance and forward request to your jsp page with form. 
>>> Struts will do the rest. That is all.
>> 
>> The problem is that the ActionForm instance is created only when needed. 
>> In case of a request-scoped form bean, it is created only on form 
>> submitting.
>> So you have to populate the HTML form with the correct values taken, for 
>> instance, from a domain object, or a data transfer object (DTO).
>> To make things clear:
>> 1. Call the action that will show the JSP page containing the form.
>> 2. The action calls the model layer, putting an object (filled with DB 
>> data), for instance, in request scope.
>> 3. Forward to the JSP page.
>> 4. Use <html:xxxx> Struts' tags specifying "name" and "property" and 
>> eventually "value".
>> 
>> You can use DAO and DTO as Ilja suggested (though I don't like it, I 
>> prefer domain objects, but that's another story).
>> 
>> HTH
>> Antonio
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Init-of-forms-tf2337990.html#a6515994
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Init-of-forms-tf2337990.html#a6522591
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message