Hi,
I think you need do something like:
<html:form method="post" action="/your_form_mapping">
<html:text property="details.name"/>
<html:text property="details.reference"/>
</html:form>
There is no need to declare the bean or name it in your text fields.
The ActionForm seems to be okay.
Hope that helps
Phillip Chan
-----Original Message-----
From: Matthias Wessendorf [mailto:[EMAIL PROTECTED]
Sent: 14 January 2004 12:44
To: 'Struts Users Mailing List'
Subject: RE: setting Form values from JSP for an object
hi clair,
in my case i use
nested:root (must address a bean with "name") OR nested:form
only in cases like i told you...
if a bean refereces to a nested
e.g.:
person --> address
nested:text is derived from html:text
for a situation of
<nested:nest property"address">
<nested:text property="street"/>
...
it calls: address.setStreet();
cheers!
-----Original Message-----
From: Claire Wall [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 14, 2004 1:30 PM
To: Struts Users Mailing List
Subject: Re: setting Form values from JSP for an object
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" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message has been scanned for viruses by MailControl - www.mailcontrol.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]