org.apache.struts2.ServletActionContext Java Examples

The following examples show how to use org.apache.struts2.ServletActionContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BorrowAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
public String findMyBorrowInfoByPage(){
	Reader reader = (Reader) ServletActionContext.getContext().getSession().get("reader");
	//获取页面传递过来的当前页码数
	if(pageCode==0){
		pageCode = 1;
	}
	//给pageSize,每页的记录数赋值
	int pageSize = 5;
	PageBean<BackInfo> pb = null;
	pb = backService.findMyBorrowInfoByPage(reader,pageCode,pageSize);
	if(pb!=null){
		pb.setUrl("findMyBorrowInfoByPage.action?");
	}
	ServletActionContext.getRequest().setAttribute("pb", pb);
	return "success";
}
 
Example #2
Source File: BorrowAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
public String queryBorrowSearchInfo(){
	//获取页面传递过来的当前页码数
	if(pageCode==0){
		pageCode = 1;
	}
	//给pageSize,每页的记录数赋值
	int pageSize = 5;
	PageBean<BackInfo> pb = null;
	Reader reader = (Reader) ServletActionContext.getContext().getSession().get("reader");
	if("".equals(ISBN.trim()) && borrowId==0){
		backService.findMyBorrowInfoByPage(reader,pageCode,pageSize);
	}else{
		pb = backService.queryBackInfo(ISBN,reader.getPaperNO(),borrowId,pageCode,pageSize);
	}
	if(pb!=null){
		pb.setUrl("queryBorrowSearchInfo.action?ISBN="+ISBN+"&borrowId="+borrowId+"&");
	}

	ServletActionContext.getRequest().setAttribute("pb", pb);
	return "success";
}
 
Example #3
Source File: SecondKillAction.java    From Mall-Server with MIT License 6 votes vote down vote up
public String delete() {
    if (this.secondKill == null) {
        jsonResult = ResponseTemplate.error(-1, "Param secondKill is required!");
        return SUCCESS;
    }

    secondKillService.delete(this.secondKill);

    // Set status code
    HttpServletResponse res = ServletActionContext.getResponse();
    res.setStatus(400);

    Map<String, Object> map = new HashMap<>();
    jsonResult = ResponseTemplate.success(map);
    return SUCCESS;
}
 
Example #4
Source File: GetUsersAction.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public String execute()
    throws Exception
{
    //TODO: Allow user with F_USER_VIEW_WITHIN_MANAGED_GROUP and restrict viewing to within managed groups.

    users = new ArrayList<>( userService.getAllUsers() );

    ContextUtils.clearIfNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), users );
    
    if ( key != null )
    {
        filterByKey( key, true );
    }

    Collections.sort( users, new UserComparator() );

    if ( usePaging )
    {
        this.paging = createPaging( users.size() );

        users = users.subList( paging.getStartPos(), paging.getEndPos() );
    }

    return SUCCESS;
}
 
Example #5
Source File: UserAction.java    From CompanyWebsite with Apache License 2.0 6 votes vote down vote up
/**
 * 管理员密码修改
 * 
 * @return
 */
public String userPwd() {
	User user = (User) ServletActionContext.getContext().getSession().get("user");
	int state = -1;// 原密码错误
	// 取出原密码进行比对
	if (user.getPwd().equals(oldPwd)) {
		if (newPwd.equals(confirmPwd)) {
			state = 1;// 修改成功
			user.setPwd(newPwd);
			user = userService.updateUserPwd(user);
			// 重新存入session
			ServletActionContext.getContext().getSession().put("user", user);
		} else {
			state = 0;// 确认密码不一致
		}
	}
	try {
		ServletActionContext.getResponse().getWriter().print(state);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #6
Source File: LoginInterceptor.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public String intercept( ActionInvocation invocation )
    throws Exception
{
    Boolean jli = (Boolean) ServletActionContext.getRequest().getSession()
        .getAttribute( LoginInterceptor.JLI_SESSION_VARIABLE );

    if ( jli != null )
    {
        log.debug( "JLI marker is present. Running " + actions.size() + " JLI actions." );

        for ( Action a : actions )
        {
            a.execute();
        }

        ServletActionContext.getRequest().getSession().removeAttribute( LoginInterceptor.JLI_SESSION_VARIABLE );
    }

    return invocation.invoke();
}
 
Example #7
Source File: QuestionManageAction.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
public String getJudge(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	Judge judge = new Judge();
	judge.setJudgeId(judgeId);
	Judge newJudge = questionService.getJudgeById(judge);
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Set||name.equals("subjects") || name.equals("choices") || name.equals("judges")){//过滤掉集合
			return true;
		}else{
			return false;
		}
	   }
	});
	
	JSONObject jsonObject = JSONObject.fromObject(newJudge,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #8
Source File: SysConfigureAction.java    From scada with MIT License 6 votes vote down vote up
public String save() throws IOException{
	SysConfig sysConfigInfo = sysConfigService.get(1);
	sysConfigInfo.setSysName(new String(sysConfig.getSysName().getBytes("ISO-8859-1"),"UTF-8"));
	sysConfigInfo.setSysTitle(new String(sysConfig.getSysTitle().getBytes("ISO-8859-1"),"UTF-8"));
	sysConfigInfo.setSysBottomMsg(new String(sysConfig.getSysBottomMsg().getBytes("ISO-8859-1"),"UTF-8"));
	//�ļ���ȫ·����
	String filePathAndName = new String(sysConfig.getSysLogoAddr().getBytes("ISO-8859-1"),"UTF-8");
	//�ļ���+'\'
	String fileName = filePathAndName.substring(filePathAndName.lastIndexOf("\\"));
	//�ļ���
	String logoName = fileName.substring(1, fileName.length());
	//�����������е��ļ�ȫ·����
	String path =ServletActionContext.getServletContext().getRealPath(this.getSavePath())+"\\"+fileName;
	sysConfigInfo.setSysLogoAddr(logoName);
	File target = new File(path);
	copy(new File(filePathAndName),target);
	
	sysConfigService.update(sysConfigInfo);
	return "save";
}
 
Example #9
Source File: SubjectManageAction.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
public String getSubject(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	Subject subject = new Subject();
	subject.setSubjectId(subjectId);
	Subject newSubject = subjectService.getSubjectById(subject);
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Set||name.equals("subjects") || name.equals("choices") || name.equals("judges")){//过滤掉集合
			return true;
		}else{
			return false;
		}
	   }
	});
	
	JSONObject jsonObject = JSONObject.fromObject(newSubject,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #10
Source File: DocumentAction.java    From OA with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 
 * @return
 */
public String ApprovingDocumentList() {
	HttpServletRequest request = ServletActionContext.getRequest();
	Users user = (Users) request.getSession().getAttribute("admin");
	String username = user.getAccount();
	List<Document> documents = documentService.searchPageApprovingDocuments(username, (index == 0 ? 1 : index));
	request.setAttribute("currentIndex", (index == 0 ? 1 : index));
	request.setAttribute("myDocumentList", documents);
	System.out.println(username + "  ========= zy");
	List temp = documentService.SearchAllApprovingDocuments(username);
	int totals = (temp == null ? 0 : temp.size());
	request.setAttribute("totalSize", totals);
	request.setAttribute("url", "DocumentAction!ApprovingDocumentList");
	request.setAttribute("type", "approvingDocument");
	return "documentList";
}
 
Example #11
Source File: ReaderManageAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
/**
 * 根据页码查询读者
 * @return
 */
public String findReaderByPage(){
	//获取页面传递过来的当前页码数
	if(pageCode==0){
		pageCode = 1;
	}
	//给pageSize,每页的记录数赋值
	int pageSize = 5;
	PageBean<Reader> pb = readerService.findReaderByPage(pageCode,pageSize);
	if(pb!=null){
		pb.setUrl("findReaderByPage.action?");
	}
	//存入request域中
	ServletActionContext.getRequest().setAttribute("pb", pb);
	return  "success";
}
 
Example #12
Source File: UsersAction.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
/** Displays the form to edit the user.
 * @return String */
public String showEditForm() {	
	HttpSession session = ServletActionContext.getRequest().getSession();
	User u = (User) session.getAttribute("user");
	getUsersDb();
    setShowEditForm(true);
    setUsernameForm(u.getUsername());
    if ((boolean) session.getAttribute("showPass")) {
    	 setPasswordForm(u.getPassword());
    	 boolean s = false;
    	 session.setAttribute("showPass", s);
    }
    setNewPasswordForm(u.getNewPassword());
    setRepeatNewPasswordForm(u.getRepeatNewPassword());
    setEmailForm(u.getEmail());
    setTypeForm(Integer.parseInt(u.getType()));
    setRoleForm(Integer.parseInt(u.getRole()));
    setOrganisationForm(Integer.parseInt(u.getOrganisation()));
    session.setAttribute("user", u);
    return SUCCESS;
}
 
Example #13
Source File: PerformanceParametersAction.java    From OA with GNU General Public License v3.0 6 votes vote down vote up
public String deletePerformanceParameters() {
	System.out.println("performanceParametersId  is "+performanceParametersId);
	PerformanceParameters performanceParametersDel = performanceParametersService.selectPerformanceParameters(PerformanceParameters.class,performanceParametersId);
	performanceParametersService.deletePerformanceParameters(performanceParametersDel);
	
	String hql = "";
	List<PerformanceParameters> performanceParameters = performanceParametersService.getPerformanceParametersPages((index==0 ? 1 : index), PerformanceParameters.class, hql);
	int total = performanceParametersService.getAllPerformanceParameterss(PerformanceParameters.class, hql).size();
	
	HttpServletRequest request = ServletActionContext.getRequest();
	request.setAttribute("listPerformanceParameters", performanceParameters);
	request.setAttribute("currentIndex", (index==0 ?  1 : index ));
	request.setAttribute("totalSize",total);
	
	return "operator_success";
}
 
Example #14
Source File: TeacherManageAction.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
public String deleteTeacher(){
	Teacher teacher = new Teacher();
	teacher.setTeacherId(teacherId);
	boolean deleteStudent = teacherService.deleteTeacher(teacher);
	int success = 0;
	if(deleteStudent){
		success = 1;
		//由于是转发并且js页面刷新,所以无需重查
	}
	try {
		ServletActionContext.getResponse().getWriter().print(success);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e.getMessage());
	}
	
	return null;
}
 
Example #15
Source File: ContractProductAction.java    From OA with GNU General Public License v3.0 6 votes vote down vote up
public String ContractProductRecordList() {
	String hql="";
	List<ContractProductRecord> ContractProductRecords = contractProductRecordService.getpageContractProductRecords((index == 0 ? 1
			: index), ContractProductRecord.class, hql);
	for (ContractProductRecord m : ContractProductRecords) {
		System.out.println(m.toString());
	}
	getSelect();
	HttpServletRequest request = ServletActionContext.getRequest();
	request.setAttribute("listObject", ContractProductRecords);
	request.setAttribute("currentIndex", (index == 0 ? 1 : index));
	int total = contractProductRecordService.getAllContractProductRecords(ContractProductRecord.class, hql).size();
	// request.setAttribute("pid",(ContractProductRecord==null ? "": ContractProductRecord.getId()));
	request.setAttribute("totalSize", total);
	request.setAttribute("url", "ContractProductAction!ContractProductRecordList?");
	return "ContractProductRecordList";
}
 
Example #16
Source File: Form2Action.java    From Project with Apache License 2.0 6 votes vote down vote up
/**
 *  在 action 中操作域对象
 * @return
 * @throws Exception
 */
@Override
public String execute() throws Exception {
    // request 域
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("req", "reqValue");

    // session 域
    HttpSession session = request.getSession();
    session.setAttribute("sess", "sessValue");

    // ServletContext 域
    ServletContext servletContext = ServletActionContext.getServletContext();
    session.setAttribute("contextname", "contextValue");
    return NONE;
}
 
Example #17
Source File: ReaderInfoAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
/**
 * 读者密码修改
 * @return
 */
public String readerPwd(){
	Reader reader = (Reader) ServletActionContext.getContext().getSession().get("reader");
	int state = -1;//原密码错误
	//取出原密码进行比对
	if(reader.getPwd().equals(Md5Utils.md5(oldPwd))){
		if(newPwd.equals(confirmPwd)){
			state = 1;//修改成功
			reader.setPwd(Md5Utils.md5(newPwd));
			reader = readerService.updateReaderInfo(reader);
			//重新存入session
			ServletActionContext.getContext().getSession().put("reader", reader);
		}else{
			state = 0;//确认密码不一致
		}
	}
	try {
		ServletActionContext.getResponse().getWriter().print(state);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #18
Source File: UsersAction.java    From aliada-tool with GNU General Public License v3.0 6 votes vote down vote up
/** Displays the form to add the user.
 * @return String */
public String showAddForm() {
	HttpSession session = ServletActionContext.getRequest().getSession();
	User us = (User) session.getAttribute("newUser");
    getUsersDb();
    
    ServletActionContext.getRequest().getSession().setAttribute("action", defaults.getString("lang.default"));
    
    setShowAddForm(true);
    if (session.getAttribute("newUser") != null) {
		setUsernameForm(us.getUsername());
        setPasswordForm(us.getPassword());
        setRepeatPasswordForm(us.getRepeatPassword());
        setEmailForm(us.getEmail());
        setTypeForm(Integer.parseInt(us.getType()));
        setRoleForm(Integer.parseInt(us.getRole()));
        setOrganisationForm(Integer.parseInt(us.getOrganisation()));
        session.setAttribute("newUser", us);
	}
    return SUCCESS;
}
 
Example #19
Source File: CourseManageAction.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
public String getAllCourses(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	List<Course> allCourses = courseService.getAllCourses();
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Set||name.equals("subjects")){//过滤掉集合
			return true;
		}else{
			return false;
		}
	   }
	});
	
	
	String json = JSONArray.fromObject(allCourses,jsonConfig).toString();//List------->JSONArray
	try {
		response.getWriter().print(json);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #20
Source File: WorkFlowAction.java    From OA with GNU General Public License v3.0 6 votes vote down vote up
private boolean addtoServer(int i) throws IOException {
	if (uploadFiles.get(i).length() != 0) {
		String upload = ServletActionContext.getServletContext()
				.getRealPath("/upload");
		String filename = uploadFilesFileName.get(i);
		System.err.println(upload);
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
				"yyyyMMddhhmmss");
		String temp = filename.substring(0, filename.lastIndexOf("."));
		String temp2 = filename.substring(filename.lastIndexOf("."));
		String filepath = temp + simpleDateFormat.format(new Date())
				+ temp2;
		System.err.println(filepath);
		File savefile = new File(upload, filepath);
		currentFileName.add(savefile);
		System.out.println(savefile.toString());
		if (!savefile.getParentFile().exists())
			savefile.getParentFile().mkdirs();
		FileUtils.copyFile(uploadFiles.get(i), savefile);
		return true;
	}
	return false;
	// FileUtils.copyFile(image, savefile);
	// ActionContext.getContext().put("message", "文件上传成功");
}
 
Example #21
Source File: ReaderInfoAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
/**
 * 读者个人资料
 * @return
 */
public String readerInfo(){
	Map<String, Object> session = ServletActionContext.getContext().getSession();
	Reader reader = (Reader) session.get("reader");
	reader.setName(name);
	reader.setPhone(phone);
	reader.setEmail(email);
	Reader newReader = readerService.updateReaderInfo(reader);
	int success = 0;
	if(newReader!=null){
		success = 1;
		//重新存入session
		session.put("reader", newReader);
	}
	try {
		ServletActionContext.getResponse().getWriter().print(success);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #22
Source File: ForfeitAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
public String findMyForfeitInfoByPage(){
	Reader reader = (Reader) ServletActionContext.getContext().getSession().get("reader");
	//获取页面传递过来的当前页码数
	if(pageCode==0){
		pageCode = 1;
	}
	//给pageSize,每页的记录数赋值
	int pageSize = 5;
	PageBean<ForfeitInfo> pb = null;
	pb = forfeitService.findMyForfeitInfoByPage(reader,pageCode,pageSize);
	if(pb!=null){
		pb.setUrl("findMyForfeitInfoByPage.action?");
	}
	ServletActionContext.getRequest().setAttribute("pb", pb);
	return "success";
}
 
Example #23
Source File: CourseDiscussAction.java    From SmartEducation with Apache License 2.0 6 votes vote down vote up
public String appCourseDiscuss() throws Exception{
	Map<String, Object> map=new HashMap<String, Object>();
	
	SpiderCourse spiderCourseFind=spiderCourseService.findById(spiderCourseId);
	if(spiderCourseFind==null){
		map.put("name", "noCourse");
	}
	else if((model.getStuNum()==null)||(model.getStuNum().equals(""))){
		map.put("name", "noStuNum");
	}
	else{
		//设置未封装属性
		model.setAddTime(new Timestamp(new Date().getTime()));
		model.setSpiderCourse(spiderCourseFind);
		courseDiscussService.save(model);
		map.put("name", "success");
	}
	JsonUtil.toJson(ServletActionContext.getResponse(), map);
	return null;
}
 
Example #24
Source File: DocumentAction.java    From OA with GNU General Public License v3.0 6 votes vote down vote up
public String deleteDocument() {
	HttpServletRequest request = ServletActionContext.getRequest();
	String ids[] = request.getParameterValues("delid");
	Document docs = null;
	String key;
	for (String a : ids) {
		docs = documentService.findDocument(Integer.valueOf(a));
		if (docs.getTypePersist() != null) {
			key = docs.getTypePersist().replaceAll("(.*)\\|.*", "$1");
			Persistence.removeVariable(key);
		}
	}
	returns = "DocumentAction!listMyDocument";
	documentService.deleteDocuments(ids);
	return null;
}
 
Example #25
Source File: SubjectManageAction.java    From OnLineTest with Apache License 2.0 6 votes vote down vote up
public String findSubjectByPage(){
	//获取页面传递过来的当前页码数
	if(pageCode==0){
		pageCode = 1;
	}
	//给pageSize,每页的记录数赋值
	int pageSize = 5;
	
	PageBean<Subject> pb = subjectService.findSubjectByPage(pageCode,pageSize);
	if(pb!=null){
		pb.setUrl("findSubjectByPage.action?");
	}
	//存入request域中
	ServletActionContext.getRequest().setAttribute("pb", pb);
	return  "success";
}
 
Example #26
Source File: DepartmentAction.java    From SmartEducation with Apache License 2.0 6 votes vote down vote up
public String appStuDeptLevel3() throws Exception{
	Map<String, Object> map=new HashMap<>();
	Student stuFind=studentService.findByStuNum(stuNum);
	if(stuFind==null){
		map.put("name", "noStudent");
	}
	else{
		Department deptFind=stuFind.getDepartment();
		if(deptFind==null){
			map.put("name", "noDept");
		}
		else{
			Department deptLevel2=deptFind.getParent();
			List<Department> deptList=departmentService.findByParent(deptLevel2);
			ClassPropertyFilter.ListDepartmentFilter(map, deptList);
			map.put("name", "success");
		}
	}
	JsonUtil.toJson(ServletActionContext.getResponse(), map);
	return null;
}
 
Example #27
Source File: SpiderCourseAction.java    From SmartEducation with Apache License 2.0 6 votes vote down vote up
public String listCourseDiscuss() throws Exception{
	Map<String, Object> map=new HashMap<>();
	SpiderCourse courseFind=spiderCourseService.findById(courseId);
	if(courseFind==null){
		map.put("name", "noCourse");
	}
	else{
		//课程讨论
		List<CourseDiscuss> courseDiscussList=courseDiscussService.findByCourse(courseFind);
		if(courseDiscussList.size()<1){
			map.put("discussName", "noDiscuss");
		}
		else{
			ClassPropertyFilter.ListSpiderCourseDiscussFilter(map, courseDiscussList);
			map.put("name", "success");
		}
	}
	JsonUtil.toJson(ServletActionContext.getResponse(), map);
	return null;
}
 
Example #28
Source File: AdminInfoAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
/**
 * 管理员密码修改
 * @return
 */
public String adminPwd(){
	Admin admin = (Admin) ServletActionContext.getContext().getSession().get("admin");
	int state = -1;//原密码错误
	//取出原密码进行比对
	if(admin.getPwd().equals(Md5Utils.md5(oldPwd))){
		if(newPwd.equals(confirmPwd)){
			state = 1;//修改成功
			admin.setPwd(Md5Utils.md5(newPwd));
			admin = adminService.updateAdminInfo(admin);
			//重新存入session
			ServletActionContext.getContext().getSession().put("admin", admin);
		}else{
			state = 0;//确认密码不一致
		}
	}
	try {
		ServletActionContext.getResponse().getWriter().print(state);
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #29
Source File: ForfeitAction.java    From LibrarySystem with Apache License 2.0 6 votes vote down vote up
public String  getForfeitInfoById(){
	HttpServletResponse response = ServletActionContext.getResponse();
	response.setContentType("application/json;charset=utf-8");
	ForfeitInfo forfeitInfo = new ForfeitInfo();
	forfeitInfo.setBorrowId(borrowId);
	ForfeitInfo  newForfeitInfo = forfeitService.getForfeitInfoById(forfeitInfo);
	JsonConfig jsonConfig = new JsonConfig();
	jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
	    public boolean apply(Object obj, String name, Object value) {
		if(obj instanceof Authorization||name.equals("authorization") || obj instanceof Set || name.equals("borrowInfos")){	
			return true;
		}else{
			return false;
		}
	   }
	});
	
	
	JSONObject jsonObject = JSONObject.fromObject(newForfeitInfo,jsonConfig);
	try {
		response.getWriter().print(jsonObject);
	} catch (IOException e) {
		throw new RuntimeException(e.getMessage());
	}
	return null;
}
 
Example #30
Source File: StudentAction.java    From SmartEducation with Apache License 2.0 6 votes vote down vote up
public String appStuModifyInfo() throws Exception{
	Map<String, String> map=new HashMap<>();
	//取出源对象
	Student stuFind=studentService.findByStuNum(model.getStuNum());
	if(stuFind==null){
		map.put("name", "noStudent");
	}
	else{
		stuFind.setQqNum(model.getQqNum());
		stuFind.setSex(model.getSex());
		stuFind.setTelphone(model.getTelphone());
		//更新
		studentService.update(stuFind);
		map.put("name", "success");
	}
	JsonUtil.toJson(ServletActionContext.getResponse(), map);
	return null;
}