📄 viewchangeaction.java
字号:
package kangyi.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import kangyi.form.CountryManagerForm;
import kangyi.model.CountryManager;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import zhangchunliang.model.AppMode;
/**
* <p>Description : 选择跳转页面是跳转到删除页面还是修改页面 </p>
* <p>Project : ciqms
* <p>Company : 东软股份国际合作事业部</p>
* <p>Create Date : 2005.4.17</P>
* @author : 康毅 | kangyi@neusoft.com
* @version : 0.2
* @see : kangyi.form.CountryManagerForm
* @see : kangyi.model.CountryManager
*
*/
public class ViewChangeAction extends Action {
public ActionForward execute(ActionMapping map, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
if(!AppMode.getAppMode()){
System.out.println("Application is terminated...");
return map.findForward("appInfo");
}
String userDeleteGrant = (String) request.getSession().getAttribute(
"userDeleteGrant");
String userUpdateGrant = (String) request.getSession().getAttribute(
"userUpdateGrant");
/*获得表单里信息 是跳转到删除页面还是跳转到修改页面*/
String deleteormodify = request.getParameter("deleteormodify");
/*获得锁定修改的记录的主键*/
String no = request.getParameter("no");
/*把获得的值SET到自定义的 FORM 中去*/
((CountryManagerForm) form).setNo(no);
/*事例化表单 为传递参数做准备*/
CountryManagerForm countrymanagerform = ((CountryManagerForm) form);
/*事例化功能类*/
CountryManager countrymanager = new CountryManager();
/*如果是删除 直接删除信息*/
if (deleteormodify.equals("delete") && no!=null&&userDeleteGrant=="Y") {
boolean b = countrymanager.ViewDelete(countrymanagerform);
if (b) {
return map.findForward("deletesuccess");
} else
/*返回信息为请选择您要操作的对象*/
return map.findForward("deletefailing");
}
else if (deleteormodify.equals("delete") && no!=null&&userDeleteGrant=="N"){
return map.findForward("filter");
}else
/*如果是修改则跳转到修改页,根据主键锁定修改记录并把城市和国家名称传过去*/
if (deleteormodify.equals("modify") && no!=null&&userUpdateGrant=="Y") {
String str[] = countrymanager.ModifyView(countrymanagerform);
request.setAttribute("no", no);
request.setAttribute("countryname", str[0]);
request.setAttribute("cityname", str[1]);
return map.findForward("modify");
} else if (deleteormodify.equals("modify") && no!=null&&userUpdateGrant=="N"){
return map.findForward("filter");
}else{
/*返回信息为请选择您要操作的对象*/
return map.findForward("deletefailing");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -