Publishing.java
上传用户:toby828
上传日期:2015-06-26
资源大小:8558k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. package com.action;
  2. import org.apache.struts.action.ActionMapping;
  3. import org.apache.struts.action.ActionForm;
  4. import javax.servlet.http.HttpServletRequest;
  5. import javax.servlet.http.HttpServletResponse;
  6. import org.apache.struts.action.ActionForward;
  7. import com.actionForm.PublishingForm;
  8. import org.apache.struts.action.Action;
  9. import com.dao.PublishingDAO;
  10. public class Publishing extends Action {
  11.     private PublishingDAO pubDAO = null;
  12.     public Publishing() {
  13.         this.pubDAO = new PublishingDAO();
  14.     }
  15.     public ActionForward perform(ActionMapping mapping, ActionForm form,
  16.                                  HttpServletRequest request,
  17.                                  HttpServletResponse response) {
  18.         PublishingForm publishingForm = (PublishingForm) form;
  19.         String action =request.getParameter("action");
  20.         System.out.println("npublishing**************action="+action);
  21.         if(action==null||"".equals(action)){
  22.             request.setAttribute("error","您的操作有误!");
  23.             return mapping.findForward("error");
  24.         }else if("pubQuery".equals(action)){
  25.             return pubQuery(mapping,form,request,response);
  26.         }
  27.         request.setAttribute("error","操作失败!");
  28.         return mapping.findForward("error");
  29.     }
  30.     /***********************查询全部出版社信息**************************/
  31.     private ActionForward pubQuery(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){
  32.     String str=null;
  33.     request.setAttribute("book",pubDAO.query(str));
  34.     return mapping.findForward("pubQuery");
  35.        }
  36. }