Hi:
This is the related eneities in my app:
@Entity
@Table(
name = "t_user")
public class User {
private int id;
private List<RoleType> role;
@ElementCollection(
targetClass = RoleType.class)
@CollectionTable(
name = "t_user_roles",
joinColumns = @JoinColumn(
name = "user_id"))
@Enumerated(EnumType.STRING)
@LazyCollection(LazyCollectionOption.FALSE)
public List<RoleType> getRole() {
return role;
}
//seter and getter
}
public enum RoleType {
VIP, SysManger, Publisher;
}
Now,in my page I want to build the page according to current user’s roletype.
So I need something like :
<s:set value="#session.current_user" var="cuser"/>
<s:if test="#cuser.role.contains(com.test.entity.RoleType.Publisher)">
<li><a href="common/listTask_userPub?uid=<s:property value='#cuser.id'/>">Tasks published by Me</a></li>
</s:if>
But it does not work at all,so I want to know if there is any other idea to meet my requriement?
By this line
you are setting the
cuserscope to action level and in the nest line you are trying to access it from the session level. i guess you need to do something likethats my high level guess hope it might help you.