📄 reminddeleteaction.java
字号:
/*
* 创建日期 2005-12-27
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package bit.jeffy.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import bit.jeffy.db.DataStore;
/**
* @author jeffy
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class RemindDeleteAction extends Action {
/* (非 Javadoc)
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
public ActionForward execute(ActionMapping map, ActionForm from,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO 自动生成方法存根
HttpSession session = request.getSession();
ActionErrors errors = new ActionErrors();
String userZh = (String)session.getAttribute("current_user");
if( userZh == null ) {
errors.add("fail_1",new ActionError("remind.delete.action.a"));
saveErrors(request,errors);
return (map.findForward("reminddeletefail"));
}else {
userZh = new String(userZh.getBytes("ISO-8859-1"),"GB2312");
}
String id = null, page = null;
page = request.getParameter("page");
id = request.getParameter("id");
if(page == null) {
page = "0";
} else {
page = new String(page.getBytes("ISO-8859-1"),"GB2312");
}
if(id == null) {
errors.add("fail_2",new ActionError("remind.delete.action.b"));
saveErrors(request,errors);
map.findForward("reminddeletefail");
} else {
id = new String(id.getBytes("ISO-8859-1"),"GB2312");
}
DataStore ds = DataStore.getInstance();
String sql = "delete from ClientRemind where id='"+
id+"'";
ds.beginTransaction();
try {
ds.execute(sql);
}catch(Exception e) {
ds.ErrorOccur();
ds.commitTransaction();
errors.add("fail_3",new ActionError("remind.delete.action.c"));
saveErrors(request,errors);
return (map.findForward("reminddeletefail"));
}
ds.commitTransaction();
request.setAttribute("page",page);
request.setAttribute("view","4");
return (map.findForward("reminddeleteok"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -