📄 studentinfoaction.java
字号:
//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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -