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

📄 roomaction.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

	/**
	 * 根据id修改教室信息
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return forward 响应成功跳转到query方法,查询修改后的新信息。
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 */
	public ActionForward update(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		RoomForm roomForm=(RoomForm) form;
		ActionForward forward=mapping.findForward("input");
		RoomDTO roomDTO =new RoomDTO();
		boolean flag=false;
		try {
			BeanUtils.copyProperties(roomDTO, roomForm);
			service.setDataSource(this.getDataSource(request,"mydatasource"));
			service.modify(roomDTO);
			flag=true;
			if(flag){
				forward=mapping.findForward("roomlist");
			}
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		} catch (AppException e) {
			e.printStackTrace();
		}
		return forward;	
	}
	
	/**
	 * 在数据字典中提取教室状态
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return null 无返回
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 */
	public ActionForward findroomstatues(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		RoomForm roomForm = (RoomForm) form;
	  	ActionForward forward=mapping.getInputForward();
	  	DictionaryDTO dto=new DictionaryDTO();
		ArrayList list=null;
		Object[] objs=null;
		try {
				dto.setRowPerPage("10000");
				dto.setCurrentPage("1");
				dto.setPid("169");
				service.setDataSource(this.getDataSource(request,"mydatasource"));
				 objs=(Object[])service.list(dto);
				list=(ArrayList)objs[0];
				if(list.size()!=0){
					request.setAttribute("roomstatues",list);
				}

		}catch (AppException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	/**
	 * 在数据字典中提取教室类型
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return null 无返回
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 */
	public ActionForward findroomtype(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		RoomForm roomForm = (RoomForm) form;
	  	ActionForward forward=mapping.getInputForward();
	  	DictionaryDTO dto=new DictionaryDTO();
		ArrayList list=null;
		Object[] objs=null;
		try {
				dto.setRowPerPage("10000");
				dto.setCurrentPage("1");
				dto.setPid("164");
				service.setDataSource(this.getDataSource(request,"mydatasource"));
				 objs=(Object[])service.list(dto);
				list=(ArrayList)objs[0];
				if(list.size()!=0){
					request.setAttribute("roomtype",list);
				}

		}catch (AppException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	/**
	 * 在数据字典中提取专业
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return null 无返回
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 */
	public ActionForward findroomscope(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		RoomForm roomForm = (RoomForm) form;
	  	ActionForward forward=mapping.getInputForward();
	  	DictionaryDTO dto=new DictionaryDTO();
		ArrayList list=null;
		Object[] objs=null;
		try {
				dto.setRowPerPage("10000");
				dto.setCurrentPage("1");
				dto.setScope("7");
				service.setDataSource(this.getDataSource(request,"mydatasource"));
				 objs=(Object[])service.list(dto);
				list=(ArrayList)objs[0];
				if(list.size()!=0){
					request.setAttribute("scopelist",list);
				}

		}catch (AppException e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	/**
	 * 查询大纲信息
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return null
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 * @throws AppException 应用异常
	 */
	public ActionForward findclassno(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws AppException{
		RoomForm roomForm=(RoomForm) form;
		ActionForward forward=mapping.findForward("input");
		RoomDTO roomDTO =new RoomDTO();
		Object[] obj=null;
		ArrayList list=null;
		String currentPage=request.getParameter("currentPage");
		String type=request.getParameter("type");

		try {
			BeanUtils.copyProperties(roomDTO, roomForm);
			PaginationVO paginationVO = new PaginationVO();
			if(roomForm.getClassroomType()!=null&&!"".equals(roomForm.getClassroomType())){
				roomDTO.setClassroomType(URLDecoder.decode(roomForm.getClassroomType()));
			}
			if(roomForm.getScope()!=null&&!"".equals(roomForm.getScope())){
				roomDTO.setScope(URLDecoder.decode(roomForm.getScope()));
			}
			if(type==null||type.equals("")||type.equals("0")){
				currentPage="1";
			}else if(type.equals("1")){
				currentPage=String.valueOf(Integer.parseInt(roomDTO.getCurrentPage())-1);
			}else if(type.equals("2")){
				currentPage=String.valueOf(Integer.parseInt(roomDTO.getCurrentPage())+1);
			}else if(type.equals("3")){
				currentPage=(String) request.getParameter("allpage");
			}
			paginationVO.setCurrentPage(Integer.parseInt(currentPage));
			roomDTO.setCurrentPage(String.valueOf(paginationVO.getCurrentPage()));
			roomDTO.setRowPerPage("10000");
			service.setDataSource(this.getDataSource(request,"mydatasource"));
			obj=(Object[]) service.findAll(roomDTO);
			int count=((Integer) obj[0]).intValue();
			paginationVO.setResultsNumber(count);
			paginationVO.setRowsPerPage(8);
			paginationVO.setAllPages((count/paginationVO.getRowsPerPage())+(count%paginationVO.getRowsPerPage()!=0?1:0));
			list=(ArrayList)obj[1];
			if(list.size()!=0&&list!=null){
				request.setAttribute("list", list);
				request.setAttribute("roomDTO",roomDTO);
				request.setAttribute("paginationVO", paginationVO);
				forward =mapping.findForward("queryroom");
			}else{
				forward =mapping.findForward("failingQuery");
			}
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}

		return null;	
	}
	/**
	 * 检查教室编号的唯一性
	 * @param mapping 响应转发请求
	 * @param form  RoomForm对象
	 * @param request 请求响应
	 * @param response 响应结果
	 * @return null
	 * @author 陈忠
	 * Creation date:04-30-2008 
	 * @throws AppException 应用异常
	 */
	 public ActionForward check(ActionMapping mapping, ActionForm form,
				HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException, IOException {
		  RoomForm roomForm = (RoomForm) form;
		  ActionForward forward=mapping.getInputForward();
			String no=request.getParameter("classroomNo");
			response.setContentType("text/html");
			String responseContext="true";
			PrintWriter out=response.getWriter();
			Object[] obj=null;
			try {
				RoomDTO roomDTO=new RoomDTO();
				BeanUtils.copyProperties(roomDTO, roomForm);
				roomDTO.setCurrentPage("1");
				roomDTO.setRowPerPage("10000");
				service.setDataSource(getDataSource(request,"mydatasource"));
				obj=(Object[])service.findAll(roomDTO);
				ArrayList list=(ArrayList)obj[1];	
				if(list.size()!=0&&list!=null){
				for(Iterator it = list.iterator();it.hasNext();){
					RoomVO roomVO=(RoomVO)it.next();
					if(no.equals(roomVO.getClassroomNo())){
						responseContext="false";
					}
				}
				}
				if(no==null||no.equals("")){
					responseContext="null";
				}
				out.println(responseContext);
				out.flush();
				out.close();
			}catch (AppException e) {
				e.printStackTrace();
			}
			return null; 
	
		}
	  
}

⌨️ 快捷键说明

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