Hi Reuven,
In the action bean I added the Set<Roles> to List
private List<Roles>rolesavilable=new ArrayList<Roles>();
public List<Roles> getRolesavilable() {
return rolesavilable;
}
public void setRolesavilable(List<Roles> rolesavilable) {
this.rolesavilable = rolesavilable;
@DefaultHandler
public Resolution view() {
rolesavilable=new
ArrayList<Roles>(roleservice.findAll());//adding set to list
return new ForwardResolution("pages/Register.jsp");
}
In jsp I have
<tr>
<th><stripes:label for="rolesavilable"
/>:</th>
<td><stripes:select name="rolesavilable"
multiple="true" >
<stripes:option
>--Roles--</stripes:option>
<stripes:options-collection
collection="${actionBean.rolesavilable}"
label="ROLES" />
</stripes:select> </td>
</tr>
But in the save method of same action bean I get null for "rolesavilable"
@HandlesEvent("save")
public Resolution save() {
System.out.println("checking roles"+rolesavilable);//[] its null
here
service.saveUser(user);
System.out.println("registered sussefuly");
return new ForwardResolution("/index.jsp");
}
Am I going wrong in the stripes:select tag I hope.
From: Reuven Gaisin [mailto:gais...@gmail.com]
Sent: Friday, August 17, 2012 2:34 AM
To: Stripes Users List
Subject: Re: [Stripes-users] stripes Question
Try changing the roles member variable in the Person class to a List
Person
{
private List<Roles> roles;
public void setRoles(List<Roles> roles )
{
this.roles = roles
}
public List<Roles> getRoles()
{
return this.roles;
}
}
Let me know if that works.
Reuven
On Thu, Aug 16, 2012 at 5:38 AM, Vyman H <vyman.huig...@marlabs.com> wrote:
Can u tell me about stripes select collection
How the value is assigned to
Person{
Set<Roles> roles;
...with setter getter
}
RegActionBean{
Person person;
. with setter getter;
@Defaulthandler
{
Set<Roles>availableroles=rolesservice.findall()//I get the roles here
forwardResolution (JSP Page)
}
}
Jsp page I have
<tr>
<th><stripes:label for="person.roles" />:</th>
<td><stripes:select name="person.roles" >
<stripes:option
formatType="Set">--Roles--</stripes:option>
<stripes:options-collection
collection="${actionBean.
availableroles }" value="role_id"
label="ROLES" />
</stripes:select> </td>
</tr>
="${actionBean. availableroles }" I am getting Set<Roles>
But after the form is submitted and person is instantiated all the other
properties are getting set but except Person.roles.. it is null
With thanks
Vyman
----------------------------------------------------------------------------
--
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
------------------------------------------------------------------------------
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