struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claire Wall" <claire.w...@kurtosys.com>
Subject Re: setting Form values from JSP for an object
Date Wed, 14 Jan 2004 12:29:51 GMT
yeah i'm pretty familiar with nested tags having used them in situations
where I have objects nested within objects within my form e.g. to render a
tree structure. I thought it was a replacement for logic tags in these sort
of situations and have never considered using them elsewhere.

this works now thanks Matthias!

quick one though: what is the difference between nested & logic tags and
nested & html tags and in which situations would you choose to use nested
not the others?


cheers
claire :)


----- Original Message -----
From: "Matthias Wessendorf" <mailings@matthias-wessendorf.de>
To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
Sent: Wednesday, January 14, 2004 11:46 AM
Subject: RE: setting Form values from JSP for an object


> Hi Claire
>
> have you tried the nested-tag?
>
> like this?
>
> <nested:form action="/nested">
> <nested:nest property="details">
> name: <nested:text property="name"/><br/>
> ref: <nested:text property="reference"/><br/>
> </nested:nest>
> <html:submit/>
> </nested:form>
> your formBean (detailsForm) is associated action-path /nested
>
> greetings
>
> Matthias
>
>
>
> -----Original Message-----
> From: Claire Wall [mailto:claire.wall@kurtosys.com]
> Sent: Wednesday, January 14, 2004 12:36 PM
> To: Struts Users Mailing List
> Subject: setting Form values from JSP for an object
>
>
> Hi,
>
> In have an ActionForm which contains an object called 'Details' like so:
>
>
> public class DetailsForm extends ActionForm
> {
>     private Details details = new Details();
>
>     public void setDetails(Details details)
>     {
>     this.details = details;
>     }
>
>     public Details getDetails()
>     {
>         return details;
>     }
> }
>
>  and the Details class contains two strings: name and reference, plus
> the getters and setters.
>
>
> Now the problem i have is that in my JSP i can render these values fine
> in text boxes. I want the user to be able to change the values, submit
> the form and then save the changes. However, I cannot find the way that
> will call the setters of the Details object. Is this possible and how is
> it done? I have tried the following ways in my JSP:
>
> Firstly, defined a bean and then used this bean definition to render my
> text boxes:
>
> <bean:define id="detail" name="DetailsForm" property="details"/>
>
> <html:text name="detail" property="name" style="width:150px"/>
> <html:text name="detail" property="reference" style="width:150px"/>
>
> <html:submit><bean:message key="button.save"/></html:submit>
>
>
> Secondly, didnt define the bean using <bean:define> but instead did
> this:
>
> <html:text name="DetailsForm" property="details.name"
> style="width:150px"/> <html:text name="DetailsForm"
> property="details.reference" style="width:150px"/>
>
> <html:submit><bean:message key="button.save"/></html:submit>
>
> This didnt work either, I'm assuming because only the setters are being
> called, and not get().set() like I want..
>
>
> Is there any way to call the setters for a class within my ActionForm??
> Any help would be appreciated.
>
>
> Claire :)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



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


Mime
View raw message