📄 firstquestionaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.accphr.web.action;
import java.io.PrintWriter;
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 org.apache.struts.actions.DispatchAction;
import com.accphr.biz.IFirstQuestionBiz;
import com.accphr.entity.FirstQuestion;
import com.accphr.page.PageResult;
import com.accphr.web.form.FirstQuestionForm;
public class FirstQuestionAction extends DispatchAction {
private IFirstQuestionBiz firstQuestionBiz;
public void setFirstQuestionBiz(IFirstQuestionBiz firstQuestionBiz) {
this.firstQuestionBiz = firstQuestionBiz;
}
//显示
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
FirstQuestionForm firstQuestionForm = (FirstQuestionForm) form;
PageResult pageResult=firstQuestionForm.getPageResult();
this.firstQuestionBiz.setPageResult(null, pageResult);
System.out.println(((FirstQuestion)pageResult.getList().get(0)).getFirstKindId());
firstQuestionForm.setPageResult(pageResult);
return mapping.findForward("tolist");
}
//到增加页面
public ActionForward toAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
FirstQuestionForm firstQuestionForm = (FirstQuestionForm) form;
String temp=this.firstQuestionBiz.findNewId();
request.setAttribute("newid", temp);
return mapping.findForward("toadd");
}
//添加
public ActionForward doAdd(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
FirstQuestionForm firstQuestionForm = (FirstQuestionForm) form;
FirstQuestion firstQuestion=firstQuestionForm.getFirstQuestion();
this.firstQuestionBiz.add(firstQuestion);
PrintWriter out=response.getWriter();
out.print("<script>alert('添加成功');location.href='firstQuestion.do?opfq=toList'</script>");
return null;
}
//删除
public ActionForward doDel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
FirstQuestionForm firstQuestionForm = (FirstQuestionForm) form;
Short firstid=Short.parseShort(request.getParameter("pcid"));
this.firstQuestionBiz.del(firstid);
PrintWriter out=response.getWriter();
out.print("<script>alert('删除成功');location.href='firstQuestion.do?opfq=toList'</script>");
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -