📄 searchdepidaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.xfaccp.struts.action.emp;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.xfaccp.base.BaseAction;
import com.xfaccp.form.DepartmentTable;
/**
* MyEclipse Struts
* Creation date: 10-30-2007
*
* XDoclet definition:
* @struts.action
*/
public class SearchDepIdAction extends BaseAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
DepartmentTable department=(DepartmentTable)form;
DepartmentTable dep=new DepartmentTable();
String depname="";
int did=0;
try
{
List depIdList=command.findByExample(department);//返回一个对象
//将这个list对象放入session 中
HttpSession session=request.getSession();
session.setAttribute("depid", depIdList);
for(int i=0;i<depIdList.size();i++)
{
dep=(DepartmentTable)depIdList.get(i);
depname=dep.getDepName();
did=dep.getId();
System.out.println(did+"**********"+depname);
}
return mapping.findForward("createEmployee");
}catch(Exception e)
{
e.printStackTrace();
System.out.println("This is the error in searchDepId!!!!!");
return mapping.findForward("error");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -