studentinfoaction.java

来自「为基于J2EE(Java2 Platform」· Java 代码 · 共 68 行

JAVA
68
字号
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.1/xslt/JavaClass.xslpackage com.huang.actions;import java.util.ArrayList;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;import com.huang.common.DB.DBtool;import com.huang.forms.StudentInfoForm;public class StudentInfoAction extends Action {	public ActionForward execute(		ActionMapping mapping,		ActionForm form,		HttpServletRequest request,		HttpServletResponse response) {		StudentInfoForm studentInfoForm = (StudentInfoForm) form;		// TODO Auto-generated method stub				String index = (String)request.getParameter("index");							if(index.equals("select")) {			String method = (String)request.getParameter("method");			String text = (String)request.getParameter("text");			ArrayList list = null;			if(method.equals("all")) {				list = DBtool.getDataList("v_student",new String[]{"student_id","student_name","student_sex","dept_name","profession_name"});			}else if(method.equals("id")) {				list = DBtool.getDataList("v_student",new String[]{"student_id","student_name","student_sex","dept_name","profession_name"},"student_id='"+text+"'");			}else if(method.equals("name")) {				list = DBtool.getDataList("v_student",new String[]{"student_id","student_name","student_sex","dept_name","profession_name"},"student_name='"+text+"'");			}else if(method.equals("dept")) {				list = DBtool.getDataList("v_student",new String[]{"student_id","student_name","student_sex","dept_name","profession_name"},"dept_name='"+text+"'");			}else if(method.equals("profession")) {				list = DBtool.getDataList("v_student",new String[]{"student_id","student_name","student_sex","dept_name","profession_name"},"profession_name='"+text+"'");			}			request.setAttribute("student",list);			return mapping.findForward("success");		}				if(index.equals("delete")) {			String student_id = (String)request.getParameter("id");			String sql = "delete from tb_student where student_id ='"+student_id+"'";			DBtool.updateData(sql);			 		}				ArrayList list = new ArrayList();		request.setAttribute("student",list);		return mapping.findForward("success");	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?