日期:2014-05-17 浏览次数:20696 次
package com.zjlolife.test1.domain;
import java.util.List;
public class User {
private String id;
private String name;
private List<Role> roles;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
}
package com.zjlolife.test1.domain;
public class Role {
private String roleId;
private String name;
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.zjlolife.test1.action;
import com.zjlolife.test1.domain.User;
public class FormAction {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String execute() {
System.out.println(user.getRoles().get(0).getRoleId());
return "success";
}
}
ognl.OgnlException: source is null for getProperty(null, "roles")