jsp代码
[code="java"]
[/code]
实体类
[code="java"]
package com.yunwang.entity;
import java.util.HashSet;
import java.util.Set;
/**
-
TRole entity. @author MyEclipse Persistence Tools
*/
@SuppressWarnings("unchecked")
public class TRole implements java.io.Serializable {/**
- */ private static final long serialVersionUID = 1L; // Fields
private Long sn;
private String roleName;
private Long orderNum;
private String memo;
private String createDate;
private String flag;
private Set TModules = new HashSet(0);
private Set TGroups = new HashSet(0);
private Set TActionAccesses = new HashSet(0);// Constructors
/** default constructor */
public TRole() {
}/** minimal constructor */
public TRole(String roleName, Long orderNum, String createDate, String flag) {
this.roleName = roleName;
this.orderNum = orderNum;
this.createDate = createDate;
this.flag = flag;
}/** full constructor */
public TRole(String roleName, Long orderNum, String memo,
String createDate, String flag, Set TModules, Set TGroups,
Set TActionAccesses) {
this.roleName = roleName;
this.orderNum = orderNum;
this.memo = memo;
this.createDate = createDate;
this.flag = flag;
this.TModules = TModules;
this.TGroups = TGroups;
this.TActionAccesses = TActionAccesses;
}// Property accessors
public Long getSn() {
return this.sn;
}public void setSn(Long sn) {
this.sn = sn;
}public String getRoleName() {
return this.roleName;
}public void setRoleName(String roleName) {
this.roleName = roleName;
}public Long getOrderNum() {
return this.orderNum;
}public void setOrderNum(Long orderNum) {
this.orderNum = orderNum;
}public String getMemo() {
return this.memo;
}public void setMemo(String memo) {
this.memo = memo;
}public String getCreateDate() {
return this.createDate;
}public void setCreateDate(String createDate) {
this.createDate = createDate;
}public String getFlag() {
return this.flag;
}public void setFlag(String flag) {
this.flag = flag;
}public Set getTModules() {
return this.TModules;
}public void setTModules(Set TModules) {
this.TModules = TModules;
}public Set getTGroups() {
return this.TGroups;
}public void setTGroups(Set TGroups) {
this.TGroups = TGroups;
}public Set getTActionAccesses() {
return this.TActionAccesses;
}public void setTActionAccesses(Set TActionAccesses) {
this.TActionAccesses = TActionAccesses;
}
}
[/code]
struts2配置信息
[code="java"]
<package name="employee" extends="struts-default">
<!-- 验证用户是否登录 -->
<interceptors>
<interceptor name="permission" class="com.yunwang.web.interceptor.PermissionInterceptor"/>
<!--定义一个包含权限检查的拦截器栈-->
<interceptor-stack name="permissionStack">
<!--配置内建默认拦截器,限制性系统自带的拦截器-->
<interceptor-ref name="defaultStack"/>
<!--配置自定义的拦截器,在执行自定义的拦截器-->
<interceptor-ref name="permission" />
</interceptor-stack>
</interceptors>
<!-- 全包拦截 -->
<default-interceptor-ref name="permission" />
<global-results>
<result name="forwork" type="redirectAction">PermissionAction.action</result>
</global-results>
<!-- 模块管理 -->
<action name="moduleAction" class="moduleAction" >
</action>
<!-- 部门管理 -->
<action name="deptPanelAction" class="deptPanelAction" >
</action>
<!-- 用户管理 -->
<action name="usersAction" class="usersAction"></action>
<!-- 权限管理 -->
<action name="roleAction" class="roleAction" ></action>
<!-- 所有页面的跳转 -->
<action name="forwordAction" class="forwordIndexAction">
<result name="long-source" >/WEB-INF/jsp/home/index.jsp</result>
<result name="todeptPanel" >/WEB-INF/jsp/dept/deptPanel.jsp</result>
<result name="toUserPanel" >/WEB-INF/jsp/dept/userPanel.jsp</result>
<result name="toRolePanel" >/WEB-INF/jsp/RoleManage/roleMain.jsp</result>
</action>
</package>
[/code]
action 代码
[code="java"]
package com.yunwang.web.action;
import com.opensymphony.xwork2.ActionSupport;
import com.yunwang.biz.IRoleBiz;
import com.yunwang.entity.TRole;
public class RoleAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
private IRoleBiz roleBiz;
private TRole role;
public TRole getRole() {
return role;
}
public void setRole(TRole role) {
this.role = role;
}
public String addRole(){
System.out.println("sssssssssssssssssssssssssssssssss");
System.out.println("ssssss==="+role.getRoleName());
return null;
}
public IRoleBiz getRoleBiz() {
return roleBiz;
}
public void setRoleBiz(IRoleBiz roleBiz) {
this.roleBiz = roleBiz;
}
}
[/code]
在点击提交后获取不到值,System.out.println("ssssss==="+role.getRoleName());什么都没输出,估计空指针了,不知道那里配置信息写错了,导致得不到值。