⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 removemessageaction.java

📁 个人数字平台(可以很方便的管理个人数据) 纯java编写
💻 JAVA
字号:
/*
 * 创建日期 2006-4-8
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package bit.jeffy.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

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 RemoveMessageAction 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 form,
			HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO 自动生成方法存根
		ActionErrors errors = new ActionErrors();
		String s = request.getParameter("mid");
		int mid = Integer.parseInt(s);
		
		if(mid < 0) {
			errors.add("faild_1",new ActionError("RemoveMessageAction.a"));
			saveErrors(request,errors);
			return (map.findForward("removefail"));
		}
		
		String sql = "delete from clientmessage where ID='"+mid+"'";
		DataStore ds = DataStore.getInstance();
		
		try {
			ds.execute(sql);
		}catch(Exception e) {
			errors.add("faild_2",new ActionError("RemoveMessageAction.b"));
			saveErrors(request,errors);
			return (map.findForward("removefail"));
		}
		
		request.setAttribute("view","3");
		return (map.findForward("removeok"));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -