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

📄 noticemodifyaction.java

📁 公告管理系统。能够进行公告的发布
💻 JAVA
字号:
package nm.user.action;

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

import nm.Notice;
import nm.user.form.NoticeModifyForm;

import org.apache.struts.action.Action;
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 org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

/**
 * <strong>InsertNewUserAction </strong> inserts a new user into the database.
 */
public final class NoticeModifyAction extends Action {

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		String title = ((NoticeModifyForm) form).getTitle();
		String content = ((NoticeModifyForm) form).getContent();
		

		ActionErrors errors = new ActionErrors();
		String pageForward = "ToErrorPage";
		try {
			Notice bean = (Notice) (request.getSession()
					.getAttribute("noticeBean"));
			int ID = bean.getID();
			bean.modifyByID(ID, title, content);
//			String strSql = "update notice set title='" + title + "',content='"
//			+ content + "' where id =" + ID;
//			System.out.println(strSql);
			pageForward = "ToNoticeList";
		} catch (Exception ex) {

			ex.printStackTrace(System.out);

			errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
					"notice.modify.failed"));
			saveMessages(request, errors);

		}
		return (mapping.findForward(pageForward));

	}
}

⌨️ 快捷键说明

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