listprojectaction.java
来自「本人课程设计时做的一个用struts框架实现的基于cmmi2的项目管理系统的原型」· Java 代码 · 共 86 行
JAVA
86 行
package com.cmmi2pms.sa.project;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.http.HttpSession;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;/** * AddprojectAction.java created by EasyStruts - XsltGen. * http://easystruts.sf.net * created on 04-12-2004 * * XDoclet definition: * @struts:action path="/addproject" name="addProjectForm" input="/pages/SA/project/addproject.jsp" validate="true" * @struts:action-forward name="/pages/failure.htm" path="/pages/failure.htm" redirect="true" * @struts:action-forward name="/pages/success.htm" path="/pages/success.htm" redirect="true" */public class ListProjectAction extends Action { // --------------------------------------------------------- Instance Variables // --------------------------------------------------------- Methods /** * Method execute * @param ActionMapping mapping * @param ActionForm form * @param HttpServletRequest request * @param HttpServletResponse response * @return ActionForward * @throws Exception */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { StringBuffer message = new StringBuffer("ListProjectAction called"); servlet.log(message.toString()); Project[] projectList = null; try{ ProjectList theProjectList = new ProjectList(); theProjectList.getAllProject(); projectList = theProjectList.getProjects(); } catch (Exception e){ System.out.println("Exception is throwed from getAllProjectList:"+e.getMessage()); } message = new StringBuffer("ProjectList.getAllProject() called"); servlet.log(message.toString()); System.out.println("theProjectList length:" + projectList.length); for (int i=0; i < projectList.length;i++) { System.out.print(projectList[i].getId() + " "); System.out.print(projectList[i].getProjectID()+ " "); System.out.println(projectList[i].getProjectName()); } HttpSession session = request.getSession(); session.setAttribute("projectList",projectList ); return (mapping.findForward("SUCCESS")); //throw new UnsupportedOperationException("Generated method 'execute(...)' not implemented."); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?