I have been facing problem in assigning the value to the Set<Roles> property
here is the code
here i am having Roles set
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column
private String username;
private String firstName;
private String lastName;
private String email;
private String password;
private String phone;
/** Default constructor. */
public Person() {
}
private Set<Roles> roles;
public Set<Roles> getRoles() {
return roles;
}
public void setRoles(Set<Roles> roles) {
this.roles = roles;
}
}
this is my action bean
public class RegisterActionBean extends BaseActionBean {
private Person user;
public Person getUser () {
return user;
}
public void setUser (Person user) {
this.user= user;
}
Set<Roles>rolesavilable=new HashSet<Roles>();
public Set<Roles> getRolesavilable() {
return rolesavilable;
}
public void setRolesavilable(Set<Roles> rolesavilable) {
this.rolesavilable = rolesavilable;
}
@DefaultHandler
public Resolution view() {
rolesavilable=new
HashSet<Roles>(roleservice.findAll());
return new
ForwardResolution("pages/Register.jsp");
}
@HandlesEvent("save")
public Resolution save() {
System.out.println(user.getFirstName());
System.out.println("test for
role+++++++++++++++"+user.getRoles());
service.saveUser(user);
System.out.println("registered sussefuly");
return new ForwardResolution("/index.jsp");
}
}
here the i get the user name but i get null for Roles
this my jsp page
<table class="leftRightForm">
<tr>
<th><stripes:label for="user.firstName" />:</th>
<td><stripes:text name="user.firstName" /> <stripes:errors
field="user.firstName" /></td>
</tr>
<tr>
<th><stripes:label for="user.roles" />:</th>
<td><stripes:select name="user.roles" >
<stripes:option value="">--Roles--</stripes:option>
<stripes:options-collection
collection="${actionBean.rolesavilable}" value="role_id"
label="ROLES" />
</stripes:select> </td>
</tr>
</table>
"rolesavilable " of type Set<Roles> i get this from default handler but it
is not getting assigned to user.roles
where roles is set of type<Roles>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users