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

📄 delbookaction.java

📁 网上书店后台管理源码基于struts1.2+oracle数据库
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.dongfang.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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;
import org.apache.struts.action.DynaActionForm;

import com.dongfang.dao.BookDAO;
import com.dongfang.po.Book;

/** 
 * MyEclipse Struts
 * Creation date: 09-11-2007
 * 
 * XDoclet definition:
 * @struts.action input="/wrong.jsp" validate="true"
 */
public class DelBookAction extends Action {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		DynaActionForm idForm = (DynaActionForm)form;
		Integer id = (Integer)idForm.get("id");
		BookDAO bookdao = new BookDAO();
		Book book = bookdao.getBookById(id.intValue());
		if(book!=null)
		{
			boolean isDel = bookdao.delOneBook(book);
			if(isDel)
			{
				return mapping.findForward("toViewBookPre");
			}
			else
			{
				ActionMessages errors = new ActionMessages();
				errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("errors.delFaile"));
				this.saveErrors(request, errors);
				return mapping.getInputForward();
			}
		}
		else
		{
			ActionMessages errors = new ActionMessages();
			errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("errors.noBook"));
			this.saveErrors(request, errors);
			return mapping.getInputForward();
		}
	}
}

⌨️ 快捷键说明

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