⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectinfoaction.java

📁 为基于J2EE(Java2 Platform
💻 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 java.util.HashMap;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.SelectInfoForm;public class SelectInfoAction extends Action {	public ActionForward execute(		ActionMapping mapping,		ActionForm form,		HttpServletRequest request,		HttpServletResponse response) {		SelectInfoForm selectInfoForm = (SelectInfoForm) form;		// TODO Auto-generated method stub				String index = (String)request.getParameter("index");				System.out.println("index="+index);		if(index.equals("first")) {			ArrayList select = new ArrayList();			request.setAttribute("select",select);		}		if(index.equals("find")) {			String course_id = (String)request.getParameter("course_id");			ArrayList list = DBtool.getDataList("v_course",new String[]{"teacher_name","course_name","course_credit"},"course_id='"+course_id+"'");			String course_name = ((HashMap)list.get(0)).get("course_name").toString();			String course_credit = ((HashMap)list.get(0)).get("course_credit").toString();			String teacher_name = ((HashMap)list.get(0)).get("teacher_name").toString();						request.setAttribute("course_name",course_name);			request.setAttribute("course_credit",course_credit);			request.setAttribute("teacher_name",teacher_name);						ArrayList list1 = DBtool.getDataList("v_select",new String[]{"course_id","student_id","student_name","student_sex","dept_name","profession_name"},"course_id='"+course_id+"'");			request.setAttribute("select",list1);		}		if(index.equals("delete")) {			String student_id = (String)request.getParameter("student_id");			String course_id = (String)request.getParameter("course_id");						String sql = "delete from tb_sc where student_id='"+student_id+"' and course_id='"+course_id+"'";			DBtool.updateData(sql);			return mapping.findForward("first");		}		if(index.equals("deleteall")) {			String course_id = (String)request.getParameter("course_id");						String sql = "delete from tb_sc where course_id='"+course_id+"'";			DBtool.updateData(sql);			return mapping.findForward("first");		}		ArrayList list = DBtool.getDataList("tb_course",new String[]{"course_id","course_name"});		request.setAttribute("course",list);				return mapping.findForward("success");	}}

⌨️ 快捷键说明

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