struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <maili...@matthias-wessendorf.de>
Subject RE: setting Form values from JSP for an object
Date Wed, 14 Jan 2004 11:46:19 GMT
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


Mime
View raw message