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

📄 studentaction.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	public ActionForward queryByID(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		StudentForm stuform=(StudentForm)form;
		ActionForward forward=mapping.getInputForward();
		String str=request.getParameter("ID");
		ArrayList arraylist=null;
		StudentDTO sdto=new StudentDTO();
		try {
			sdto.setId( new Integer(str));
			service.setDataSource(this.getDataSource(request,"mydatasource"));
			arraylist=(ArrayList) service.findById(sdto);
		    if(arraylist.size()!=0){
		    	request.setAttribute("arraylist", arraylist);
		    	forward=mapping.findForward("updatestudent");
		    }
		} catch (AppException e) {
			e.printStackTrace();
		}
		return forward;
	}
	/**
	 * 根据ID号查看学生详细信息
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward queryByNO(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		StudentForm stuform=(StudentForm)form;
		ActionForward forward=mapping.getInputForward();
		String str=request.getParameter("ID");
		ArrayList arraylist=null;
		StudentDTO sdto=new StudentDTO();
		try {
			sdto.setId( new Integer(str));
			service.setDataSource(this.getDataSource(request,"mydatasource"));
			arraylist=(ArrayList) service.findById(sdto);
		    if(arraylist.size()!=0){
		    	request.setAttribute("arraylist", arraylist);
		    	forward=mapping.findForward("query");
		    }
		} catch (AppException e) {
			e.printStackTrace();
		}
		return forward;
	}
	/**
	 * 根据ID号修改学生信息
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward updateStudent(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
			StudentForm stuform=(StudentForm) form;
		    ActionForward forward=mapping.getInputForward();
		    String str=request.getParameter("ID");
		    StudentDTO sdto=new StudentDTO();
		    boolean flag=false;
		    try {
		    	BeanUtils.copyProperties(sdto, stuform);
		    	sdto.setId( new Integer(str));
				service.setDataSource(this.getDataSource(request,"mydatasource"));
			    flag=(Boolean) service.modify(sdto);

			    if(flag){
			    	forward=new ActionForward("/admins/core/student.html?method=queryByNO");
			    }
			} catch (AppException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
		return forward;
	}
	/**
	 * 根据ID号查看学生信息
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward validate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		StudentForm stuform = (StudentForm) form;
		String name =stuform.getStuNo();
		String responseContext ="true";
		List list = null;
		try {
			PrintWriter out = null;
			out = response.getWriter();
			try {
				StudentDTO sdto = new StudentDTO();
				BeanUtils.copyProperties(sdto, stuform);
				service.setDataSource(this.getDataSource(request,"mydatasource"));
				list=(ArrayList) service.list();
				if(list.size()!=0){
				request.setAttribute("stuNo", list);
    			for(Iterator it = list.iterator();it.hasNext();){ 
    				StudentVO svo = (StudentVO)it.next();
    				if(name.equals(svo.getStuNo())){
    					responseContext="false";
    				}
    			}
				}
    			out.flush();
    			out.println(responseContext);
    			out.close();
			} catch (AppException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	/**
	 * 根据范围scope的值查找性别
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward queryDic1(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
	
		DictionaryDTO ddto=new DictionaryDTO();
		ArrayList arraylist1=null;
		ActionForward forward =mapping.getInputForward();
		Object[] objs=null;
		ddto.setRowPerPage("10000");
		ddto.setCurrentPage("1");
		ddto.setScope("1");
		try {
			service.setDataSource(getDataSource(request,"mydatasource"));
			objs = (Object[])service.findAll(ddto);
			 arraylist1 =(ArrayList)objs[0];
			if(arraylist1.size()!= 0){
				request.setAttribute("arraylist1", arraylist1);
			}
		} catch (AppException e) {
			e.printStackTrace();
		}
		return null;
	}
	/**
	 * 根据范围scope的值查找籍贯
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward queryDic2(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
	
		DictionaryDTO ddto=new DictionaryDTO();
		ArrayList arraylist2=null;
		ActionForward forward =mapping.getInputForward();
		Object[] objs=null;
		ddto.setRowPerPage("10000");
		ddto.setCurrentPage("1");
		ddto.setScope("3");
		try {
			service.setDataSource(getDataSource(request,"mydatasource"));
			objs = (Object[])service.findAll(ddto);
			 arraylist2 =(ArrayList)objs[0];
			if(arraylist2.size()!= 0){
				request.setAttribute("arraylist2", arraylist2);
			}
		} catch (AppException e) {
			e.printStackTrace();
		}
		return null;
	}
	/**
	 * 根据范围scope的值查找政治面貌
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward queryDic3(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
	
		DictionaryDTO ddto=new DictionaryDTO();
		ArrayList arraylist3=null;
		ActionForward forward =mapping.getInputForward();
		Object[] objs=null;
		ddto.setRowPerPage("10000");
		ddto.setCurrentPage("1");
		ddto.setScope("5");
		try {
			service.setDataSource(getDataSource(request,"mydatasource"));
			objs = (Object[])service.findAll(ddto);
			 arraylist3 =(ArrayList)objs[0];
			if(arraylist3.size()!= 0){
				request.setAttribute("arraylist3", arraylist3);
			}
		} catch (AppException e) {
			e.printStackTrace();
		}
		return null;
	}
	/**
	 * 根据老师职称的值查找老师编号
	 * @author 吴朋
	 * @param mapping  响应转发请求
	 * @param form
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return
	 * @throws AppException 应用程序异常
	 */
	public ActionForward queryTeacherTitle(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		TeacherDTO tdto=new TeacherDTO();
		ArrayList arraylist4=null;
		ActionForward forward =mapping.getInputForward();
		Object[] objs=null;
		tdto.setRowPerPage("10000");
		tdto.setCurrentPage("1");
		tdto.setTeacher_post("班主任");
		try {
			//tdto.setTeacher_post(URLDecoder.decode(tdto.getTeacher_post()));
			service.setDataSource(getDataSource(request,"mydatasource"));
			objs = (Object[])service.load(tdto);
			 arraylist4 =(ArrayList)objs[1];
			if(arraylist4.size()!= 0){
				request.setAttribute("arraylist4", arraylist4);
			}
		} catch (AppException e) {
			e.printStackTrace();
		}
		return null;
	}
}

⌨️ 快捷键说明

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