📄 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 + -