📄 listhraction.java
字号:
package com.cmmi2pms.pp.hr;
import com.cmmi2pms.common.Constants;
import com.cmmi2pms.sa.project.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;
/**
* AdduserAction.java created by EasyStruts - XsltGen.
* http://easystruts.sf.net
* created on 04-12-2004
*
* XDoclet definition:
* @struts:action path="/adduser" name="addUserForm" input="/pages/SA/user/adduser.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 ListHrAction 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("ListHrAction called");
servlet.log(message.toString());
Hr[] hrList = null;
int projectid =100;
try{
Project theProject = new Project();
theProject = (Project) request.getSession().getAttribute(Constants.PROJECT_KEY);
projectid = Integer.parseInt( theProject.getProjectID() );
}
catch (Exception e){
System.out.println("Exception is throwed from getProjectID:"+e.getMessage());
}
try{
HrList theHrList = new HrList();
theHrList.getAllHr(projectid);
hrList = theHrList.getHrs();
}
catch (Exception e){
System.out.println("Exception is throwed from getAllHrList:"+e.getMessage());
}
message = new StringBuffer("HrList.getAllHr() called");
servlet.log(message.toString());
System.out.println("theHrList length:" + hrList.length);
for (int i=0; i < hrList.length;i++)
{
System.out.print(hrList[i].getProject()+ " ");
System.out.print(hrList[i].getName()+ " ");
System.out.print(hrList[i].getUsername()+ " ");
System.out.println(hrList[i].getRole());
}
HttpSession session = request.getSession();
session.setAttribute("hrList",hrList );
return (mapping.findForward("SUCCESS"));
//throw new UnsupportedOperationException("Generated method 'execute(...)' not implemented.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -