?? updatecategoryaction.java
字號:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.david.struts.action;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.david.bo.Category;
import com.david.bo.Userinfo;
import com.david.service.ICategoryService;
import com.david.struts.form.UpdateCategoryForm;
/**
* MyEclipse Struts
* Creation date: 10-19-2007
*
* XDoclet definition:
* @struts.action path="/updateCategory" name="updateCategoryForm" input="/form/updateCategory.jsp" scope="request" validate="true"
*/
public class UpdateCategoryAction extends FilterRequestAction {
/*
* Generated Methods
*/
private ICategoryService categoryService;
public void setCategoryService(ICategoryService categoryService) {
this.categoryService = categoryService;
}
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws IOException
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UpdateCategoryForm updateCategoryForm = (UpdateCategoryForm) form;// TODO Auto-generated method stub
Category category=new Category();
category.setId(updateCategoryForm.getCategoryId());
category.setCategoryIntro(updateCategoryForm.getCategoryIntro());
category.setCategoryName(updateCategoryForm.getCategoryName());
category.setUserinfo((Userinfo)request.getSession().getAttribute("USERINFO"));
//ICategoryService categoryService=(ICategoryService)this.getBean("categoryService");
if(categoryService.updateCategory(category)){
return mapping.findForward("updateCategoryOk");
}else{
response.getWriter().print("Error!<br/>Please try it again!");
return null;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -