Thanks Dave,
Got it working atlast.......!
Here is what I have,
public class PersonAction extends ActionSupport {
private Person person;
public String execute() throws Exception { return SUCCESS; }
public Person getPerson() {return person; }
public void setPerson(Person person) { this.person = person; }
}
public class Person implements Serializable {
private String name;
private Integer age;
private List roles;
public void setName(String name) { this.name = name; }
public String getName() { return this.name; }
public void setAge(Integer age) { this.age = age; }
public Integer getAge() { return this.age; }
public List getRoles() { return roles; }
public void setRoles(List roles) { this.roles = roles; }
}
public class Role implements Serializable {
private String name;
public String getName() { return name;}
public void setName(String name) { this.name = name;}
}
Person-Conversion.properties [This should be in the same package as the Person
class] with the below contents
CreateIfNull_roles=true
Element_roles=zm.junk.Role
JSP is
<s:form action="person" theme="ajax" >
<s:textfield label="Person Name" name="person.name"
/>
<s:textfield name="person.roles[0].name"
label="Role" />
<s:submit id="submitBtn" value="Save" theme="xhtml"
/>
</s:form>
The key is the square brackets [] used for the index instead of the round
ones...
Hope it helps others.
-Zafer
----- Original Message ----
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[email protected]>
Sent: Saturday, February 3, 2007 4:33:21 PM
Subject: Re: [S2] Re: Populating collection in struts 2 Action properties
--- zafer Mohamed <[EMAIL PROTECTED]> wrote:
> Initializing the collection also did not help. If
> possible can you please let me know what are the
> conversion-properties files u have and their
> location [should they be in the package of the class
> or in the classpath] and does it need any additional
> interceptor for this.
Oh, I missed your property file name/location.
The conversion files should be in the same package as
the *Action* class, and named
ActionName-conversion.properties, so if I have an
action called PersonInputAction then in the same
package I want a
PersonInputAction-conversion.properties. Conversions
are tied to Actions, not types.
The defaultStack of interceptors should work fine.
d.
____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367