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

📄 classaction.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 *    根据ID 获得班级信息
	 * @param form 要与SchoolForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 * @return forward 指定成功后转发的页面
	 */
	public ActionForward load1(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		ClassForm classForm = (ClassForm) form;
		ActionForward forward = mapping.getInputForward();
		String id = request.getParameter("id");
		int lid = Integer.parseInt(id);
		ClassesVO cvo = null;

		try {
			service.setDataSource(getDataSource(request,"mydatasource"));
			cvo = (ClassesVO) service.findById(lid);
			if(cvo != null){
				request.setAttribute("cvo", cvo);
				forward = mapping.findForward("find");
			}
		} catch (AppException e) {
			e.printStackTrace();
		}

		return forward;
	}
	
	/**
	 * @author 李亭 <p>
	 * Creation date:04-30-2008 
	 *    提供给其他模块调用,获得校区表的相关信息如:classNo
	 * @param form 要与ClassForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 */
	public ActionForward findClasses(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		ClassForm classForm = (ClassForm) form;
		ArrayList clist = null;
		ActionForward forward=mapping.findForward("input");

		try {
			ClassesDTO classdto = new ClassesDTO();
			BeanUtils.copyProperties(classdto, classForm);
			service.setDataSource(getDataSource(request,"mydatasource"));
			clist = (ArrayList) service.findByObject(classdto);
			request.setAttribute("clist", clist);
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (AppException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;
	}
	
	/**
	 * @author 李亭 <p>
	 * Creation date:05-07-2008 
	 *    提供给其他模块调用,获得校区表的相关信息如:classNo
	 * @param form 要与ClassForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 * @throws IOException 
	 */
	public ActionForward findClassesNo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws IOException {

		ClassForm classForm = (ClassForm) form;
		ArrayList clist = null;
		ActionForward forward=mapping.findForward("input");
		String cno=request.getParameter("classNo");
		response.setContentType("text/html");
		String responseContext="true";
		PrintWriter out=response.getWriter();
		
		try {
			if(cno==null||"".equals(cno)){
				responseContext="null";
			}else{
				ClassesDTO classdto = new ClassesDTO();
				BeanUtils.copyProperties(classdto, classForm);
				service.setDataSource(getDataSource(request,"mydatasource"));
				clist = (ArrayList) service.findByObject(classdto);
				request.setAttribute("clist", clist);
				if(clist.size()!=0&&clist!=null){
					responseContext="false";
				}else{
					responseContext="true";
				}
			}
			out.flush();
			out.println(responseContext);
			out.close();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (AppException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;
	}
	
	/**
	 * @author 李亭 <p>
	 * Creation date:05-07-2008 
	 *    提供给其他模块调用,获得校区表的相关信息如:classNo
	 * @param form 要与ClassForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 * @throws IOException 
	 */
	public ActionForward findClassesname(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws IOException {

		ClassForm classForm = (ClassForm) form;
		ArrayList clist = null;
		ActionForward forward=mapping.findForward("input");
		String selected = request.getParameter("selected");
		response.setContentType("text/html");
		String responseContext="true";
		PrintWriter out=response.getWriter();
		
		try {
			if(selected==null||"".equals(selected)){
				responseContext="null";
			}else{
			
				service.setDataSource(getDataSource(request,"mydatasource"));
				clist = (ArrayList) service.load(selected);
				request.setAttribute("clist", clist);
				if(clist.size()!=0&&clist!=null){
					responseContext="false";
				}else{
					responseContext="true";
				}
			}
			out.flush();
			out.println(responseContext);
			out.close();
		}  catch (AppException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;
	}
	
	/**
	 * @author 李亭 <p>
	 * Creation date:05-06-2008 
	 * 根据ID修改校区信息
	 * @param mapping 用来响应转发变量
	 * @param form 要与classForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从classForm中传过来的变量
	 * @return forward 指定成功后转发的页面
	 * @throws IOException 
	 */
	public ActionForward modiClasses(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		ClassForm classForm = (ClassForm) form;
		ClassesDTO classdto = new ClassesDTO();
		ActionForward forward = mapping.getInputForward();
		String id = request.getParameter("id");
		int sid = Integer.parseInt(id);
		classdto.setId(sid);

		try {
			BeanUtils.copyProperties(classdto, classForm);
			classdto.filer();
			service.setDataSource(getDataSource(request,"mydatasource"));
			Integer falg = (Integer) service.modify(classdto);
			if(falg==1){
				forward = mapping.findForward("modiclasses");
			}
		} catch (AppException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}

		return forward;
	}
	
	
	/**
	 * @author 李亭 <p>
	 * Creation date:04-30-2008 
	 *  获得校区表的相关信息如:SchoolNo
	 * @param form 要与SchoolForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 */
	public ActionForward findSchool(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		ArrayList slist = null;
		ActionForward forward=mapping.findForward("input");
		SchoolDTO schooldto = new SchoolDTO();
		try {
			
			service.setDataSource(getDataSource(request,"mydatasource"));
			slist = (ArrayList) service.findAll(schooldto);
			request.setAttribute("slist", slist);
		} catch (AppException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return null;
	}
	/**
	 * @author 李亭 <p>
	 * Creation date:04-30-2008 
	 *  获得校区表的相关信息如:SchoolNo
	 * @param form 要与SchoolForm中的变量对应
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @param schooldto 接收从SchoolForm中传过来的变量
	 * @throws IOException 
	 */
	public ActionForward casede(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws IOException {
			response.setContentType("text/html");
			response.setCharacterEncoding("utf-8");
			String selected=request.getParameter("selected");
			PrintWriter out=response.getWriter();
			String responseContext="";
			ArrayList slist = null;
			ArrayList rlist = null;
			Object[] obj=null;
			RoomVO rvo = new RoomVO();
			try {
				service.setDataSource(getDataSource(request,"mydatasource"));
				obj = (Object[]) service.alllist(selected);
				
			} catch (AppException e) {
				e.printStackTrace();
			}
			rlist=(ArrayList) obj[0];
			//rlist=(ArrayList) request.getAttribute("rlist");
			if(rlist!=null&&rlist.size()>0){
				responseContext = "<div align=right><strong >教室编号:</strong></div>_<select name='classroomNo' >";
				responseContext = responseContext + "<option value='' >请选择...</option>";
				//this.findroom(mapping, form, request, response);
				for(Iterator it = rlist.iterator(); it.hasNext();){
						rvo=(RoomVO) it.next();
						responseContext = responseContext + "<option value='" + rvo.getClassroomNo()+ "'>"
						+ rvo.getClassroomNo()+ "</option>";
				}
				responseContext = responseContext + "</select>";
			}else{
				
				responseContext = responseContext + "<option value='' ><font color='red'>该校区下没有开设教室</font></option>";
			}
			out.println(responseContext);
			out.flush();
			out.close();
		return null;
	}
	
	/**
	 * 增加页面
	 * @param mapping 用来响应转发变量
	 * @param request 请求数据时所用的变量
	 * @param response 返回数据时用的变量
	 * @return
	 */
	public ActionForward addc(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ActionForward forward = mapping.findForward("input");
		forward = mapping.findForward("addc");
		return forward;
	}
}

⌨️ 快捷键说明

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