求高手解答!JAVA和JSP 20
LOGINACTION类继承DispatchACtion,然后实现页面传值!struts-config.xml文件怎么写?...
LOGINACTION 类继承DispatchACtion,然后实现页面传值!struts-config.xml文件怎么写?
展开
2个回答
展开全部
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<!--用户管理-->
<struts-config>
<!-- ********** Form bean definition ********** -->
<form-beans>
<form-bean name="loginForm" type="com.ssi.user.web.form.LoginActionForm"></form-bean>
<form-bean name="userForm" type="com.ssi.user.web.form.UserActionForm"></form-bean>
</form-beans>
<!-- ********** Action mapping definition ********** -->
<action-mappings>
<action path="/login" type="org.springframework.web.struts.DelegatingActionProxy"
name="loginForm" scope="request" parameter="clientid">
</action>
<action path="/user" type="org.springframework.web.struts.DelegatingActionProxy"
name="userForm" scope="request" parameter="clientid">
<forward name="set_user_group" path="/WEB-INF/jsp/user/set_user_group.jsp"/>
<forward name="manage_sys_user_login_info" path="/WEB-INF/jsp/user/manage_sys_user_login_info.jsp"/>
<forward name="show_employee_info_list_dialog" path="/WEB-INF/jsp/user/show_employee_info_list_dialog.jsp"/>
<forward name="query_sys_user_login_info_list" path="/WEB-INF/jsp/user/query_sys_user_login_info_list.jsp"/>
<forward name="user_list" path="/WEB-INF/jsp/user/user_list.jsp"/>
<forward name="user_list_dialog" path="/WEB-INF/jsp/user/user_list_dialog.jsp"/>
<forward name="add_user" path="/WEB-INF/jsp/user/add_user.jsp"/>
<forward name="update_user" path="/WEB-INF/jsp/user/update_user.jsp"/>
<forward name="user_detail" path="/WEB-INF/jsp/user/user_detail.jsp"/>
<forward name="update_user_pwd" path="/WEB-INF/jsp/user/update_user_pwd.jsp"/>
<forward name="load_dic" path="/WEB-INF/jsp/comm/load_dic.jsp"/>
<forward name="user_group_list" path="/WEB-INF/jsp/user/group/user_group_list.jsp"/>
<forward name="add_user_group" path="/WEB-INF/jsp/user/group/add_user_group.jsp"/>
<forward name="update_user_group" path="/WEB-INF/jsp/user/group/update_user_group.jsp"/>
<forward name="plat_list" path="/WEB-INF/jsp/user/plat/plat_list.jsp"/>
<forward name="add_plat" path="/WEB-INF/jsp/user/plat/add_plat.jsp"/>
<forward name="update_plat" path="/WEB-INF/jsp/user/plat/update_plat.jsp"/>
</action>
<action path="/userAdvanced" type="org.springframework.web.struts.DelegatingActionProxy"
name="userForm" scope="request" parameter="clientid">
<forward name="advanced_user_list" path="/WEB-INF/jsp/user/advanced/user_list.jsp"/>
<forward name="advanced_update_user" path="/WEB-INF/jsp/user/advanced/update_user.jsp"/>
<forward name="advanced_user_group_list" path="/WEB-INF/jsp/user/group/advanced/user_group_list.jsp"/>
<forward name="advanced_update_user_group" path="/WEB-INF/jsp/user/group/advanced/update_user_group.jsp"/>
<forward name="advanced_plat_list" path="/WEB-INF/jsp/user/plat/advanced/plat_list.jsp"/>
<forward name="advanced_update_plat" path="/WEB-INF/jsp/user/plat/advanced/update_plat.jsp"/>
</action>
</action-mappings>
</struts-config>
private static final String SET_USER_GROUP = "set_user_group";
private static final String MANAGE_SYS_USER_LOGIN_INFO = "manage_sys_user_login_info";
private static final String QUERY_SYS_USER_LOGIN_INFO_LIST = "query_sys_user_login_info_list";
private static final String SHOW_EMPLOYEE_INFO_LIST_DIALOG = "show_employee_info_list_dialog";
/**
* 添加用户
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward toAddUser(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
UserActionForm userForm = (UserActionForm) form;
QueryForm queryForm = new QueryForm();
BeanUtils.copyProperties(queryForm, userForm);
userForm.setUserLoginInfo(new SysUserLoginInfo());
userForm.setPlatId(this.getPlatId(request));
userForm.setUserStatusMap(this.getUserStatusMap(request));
userForm.setEffectiveMap(this.getEffectiveMap(request));
userForm.setUserSexMap(this.getUserSexMap(request));
userForm.setYesOrNoMap(this.getYesOrNoMap(request));
userForm.setLockStatusMap(this.getLockStatusMap(request));
userForm.getUserLoginInfo().setAliveFlag(GlobalConstants.YES);
userForm.getUserLoginInfo().setState(GlobalConstants.DATA_DIC_CARD_STATE_1);
userForm.getUserLoginInfo().setLockFlag(GlobalConstants.DATA_DIC_LOCK_STATUS_0);
String[] ztree = menuService.querySysMenuInfoCheckBoxZTree(userForm.getPlatId());
userForm.setZtreeSetting(ztree[0]);
userForm.setZtreeNodes(ztree[1]);
request.setAttribute("userForm", userForm);
request.setAttribute("queryForm", queryForm);
} catch (Exception e) {
logger.error("系统异常,异常代码:" + e.toString());
request.setAttribute(GlobalConstants.REQUEST_ERROR_MESSAGE,
"系统异常,异常代码:(" + e.toString() + ")!");
return mapping.findForward(GlobalConstants.FORWARD_PAGE_ERROR);
}
return mapping.findForward(this.MANAGE_SYS_USER_LOGIN_INFO);
}
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<!--用户管理-->
<struts-config>
<!-- ********** Form bean definition ********** -->
<form-beans>
<form-bean name="loginForm" type="com.ssi.user.web.form.LoginActionForm"></form-bean>
<form-bean name="userForm" type="com.ssi.user.web.form.UserActionForm"></form-bean>
</form-beans>
<!-- ********** Action mapping definition ********** -->
<action-mappings>
<action path="/login" type="org.springframework.web.struts.DelegatingActionProxy"
name="loginForm" scope="request" parameter="clientid">
</action>
<action path="/user" type="org.springframework.web.struts.DelegatingActionProxy"
name="userForm" scope="request" parameter="clientid">
<forward name="set_user_group" path="/WEB-INF/jsp/user/set_user_group.jsp"/>
<forward name="manage_sys_user_login_info" path="/WEB-INF/jsp/user/manage_sys_user_login_info.jsp"/>
<forward name="show_employee_info_list_dialog" path="/WEB-INF/jsp/user/show_employee_info_list_dialog.jsp"/>
<forward name="query_sys_user_login_info_list" path="/WEB-INF/jsp/user/query_sys_user_login_info_list.jsp"/>
<forward name="user_list" path="/WEB-INF/jsp/user/user_list.jsp"/>
<forward name="user_list_dialog" path="/WEB-INF/jsp/user/user_list_dialog.jsp"/>
<forward name="add_user" path="/WEB-INF/jsp/user/add_user.jsp"/>
<forward name="update_user" path="/WEB-INF/jsp/user/update_user.jsp"/>
<forward name="user_detail" path="/WEB-INF/jsp/user/user_detail.jsp"/>
<forward name="update_user_pwd" path="/WEB-INF/jsp/user/update_user_pwd.jsp"/>
<forward name="load_dic" path="/WEB-INF/jsp/comm/load_dic.jsp"/>
<forward name="user_group_list" path="/WEB-INF/jsp/user/group/user_group_list.jsp"/>
<forward name="add_user_group" path="/WEB-INF/jsp/user/group/add_user_group.jsp"/>
<forward name="update_user_group" path="/WEB-INF/jsp/user/group/update_user_group.jsp"/>
<forward name="plat_list" path="/WEB-INF/jsp/user/plat/plat_list.jsp"/>
<forward name="add_plat" path="/WEB-INF/jsp/user/plat/add_plat.jsp"/>
<forward name="update_plat" path="/WEB-INF/jsp/user/plat/update_plat.jsp"/>
</action>
<action path="/userAdvanced" type="org.springframework.web.struts.DelegatingActionProxy"
name="userForm" scope="request" parameter="clientid">
<forward name="advanced_user_list" path="/WEB-INF/jsp/user/advanced/user_list.jsp"/>
<forward name="advanced_update_user" path="/WEB-INF/jsp/user/advanced/update_user.jsp"/>
<forward name="advanced_user_group_list" path="/WEB-INF/jsp/user/group/advanced/user_group_list.jsp"/>
<forward name="advanced_update_user_group" path="/WEB-INF/jsp/user/group/advanced/update_user_group.jsp"/>
<forward name="advanced_plat_list" path="/WEB-INF/jsp/user/plat/advanced/plat_list.jsp"/>
<forward name="advanced_update_plat" path="/WEB-INF/jsp/user/plat/advanced/update_plat.jsp"/>
</action>
</action-mappings>
</struts-config>
private static final String SET_USER_GROUP = "set_user_group";
private static final String MANAGE_SYS_USER_LOGIN_INFO = "manage_sys_user_login_info";
private static final String QUERY_SYS_USER_LOGIN_INFO_LIST = "query_sys_user_login_info_list";
private static final String SHOW_EMPLOYEE_INFO_LIST_DIALOG = "show_employee_info_list_dialog";
/**
* 添加用户
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward toAddUser(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
UserActionForm userForm = (UserActionForm) form;
QueryForm queryForm = new QueryForm();
BeanUtils.copyProperties(queryForm, userForm);
userForm.setUserLoginInfo(new SysUserLoginInfo());
userForm.setPlatId(this.getPlatId(request));
userForm.setUserStatusMap(this.getUserStatusMap(request));
userForm.setEffectiveMap(this.getEffectiveMap(request));
userForm.setUserSexMap(this.getUserSexMap(request));
userForm.setYesOrNoMap(this.getYesOrNoMap(request));
userForm.setLockStatusMap(this.getLockStatusMap(request));
userForm.getUserLoginInfo().setAliveFlag(GlobalConstants.YES);
userForm.getUserLoginInfo().setState(GlobalConstants.DATA_DIC_CARD_STATE_1);
userForm.getUserLoginInfo().setLockFlag(GlobalConstants.DATA_DIC_LOCK_STATUS_0);
String[] ztree = menuService.querySysMenuInfoCheckBoxZTree(userForm.getPlatId());
userForm.setZtreeSetting(ztree[0]);
userForm.setZtreeNodes(ztree[1]);
request.setAttribute("userForm", userForm);
request.setAttribute("queryForm", queryForm);
} catch (Exception e) {
logger.error("系统异常,异常代码:" + e.toString());
request.setAttribute(GlobalConstants.REQUEST_ERROR_MESSAGE,
"系统异常,异常代码:(" + e.toString() + ")!");
return mapping.findForward(GlobalConstants.FORWARD_PAGE_ERROR);
}
return mapping.findForward(this.MANAGE_SYS_USER_LOGIN_INFO);
}
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询