Java Code Examples for org.springframework.ui.ModelMap
The following examples show how to use
org.springframework.ui.ModelMap.
These examples are extracted from open source projects.
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 Project: Spring-MVC-Blueprints Author: PacktPublishing File: AdminJasperReport.java License: MIT License | 7 votes |
@RequestMapping(value = "/hrms/showJasperManagerPDF", method = RequestMethod.GET) public String showJasperManagerPDF(ModelMap model, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, JRException, NamingException { usersList = loginService.getUserList(); AdminJasperBase dsUsers = new AdminJasperBase(usersList); Map<String, Object> params = new HashMap<>(); params.put("users", usersList); JasperReport jasperReport = getCompiledFile("JRUsers", request); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dsUsers); response.setContentType("application/x-pdf"); response.setHeader("Content-disposition", "inline; filename=userList.pdf"); final OutputStream outStream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, outStream); return null; }
Example #2
Source Project: LDMS Author: iCodingStar File: FileUpload.java License: Apache License 2.0 | 6 votes |
@RequestMapping( value = "/action/file.do", method = {RequestMethod.POST, RequestMethod.GET}) public @ResponseBody String uploadPhoto(@RequestParam MultipartFile uFile, HttpServletRequest request, HttpServletResponse response, ModelMap map) { System.out.println("Hello"); try { if (uFile != null && !uFile.isEmpty()) { System.out.println("file:" + uFile.getOriginalFilename()); } } catch (Exception e) { e.printStackTrace(); } return "success"; }
Example #3
Source Project: bbs Author: diyhi File: DisableUserNameManageAction.java License: GNU Affero General Public License v3.0 | 6 votes |
/** * 禁止的用户名称 显示修改 */ @RequestMapping(params="method=edit",method=RequestMethod.GET) public String editUI(ModelMap model,Integer disableUserNameId, HttpServletRequest request, HttpServletResponse response) throws Exception { if(disableUserNameId != null && disableUserNameId >0){ //根据ID查询要修改的数据 DisableUserName disableUserName = userService.findDisableUserNameById(disableUserNameId); if(disableUserName != null){ model.addAttribute("disableUserName", disableUserName); } }else{ throw new SystemException("参数不能为空"); } return "jsp/user/edit_disableUserName"; }
Example #4
Source Project: jeecg Author: zhangdaiscott File: JformGraphreportHeadController.java License: Apache License 2.0 | 6 votes |
@RequestMapping(params = "exportXls") public String exportXls(JformGraphreportHeadEntity jformGraphreportHead,HttpServletRequest request,HttpServletResponse response , DataGrid dataGrid,ModelMap map) { CriteriaQuery cq = new CriteriaQuery(JformGraphreportHeadEntity.class, dataGrid); //查询条件组装器 org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, jformGraphreportHead); List<JformGraphreportHeadEntity> dataList= this.jformGraphreportHeadService.getListByCriteriaQuery(cq,false); List<JformGraphreportHeadPage> pageList=new ArrayList<JformGraphreportHeadPage>(); if(dataList!=null&&dataList.size()>0){ String hql0 = "from JformGraphreportItemEntity where 1 = 1 AND cGREPORT_HEAD_ID = ? "; for(JformGraphreportHeadEntity headEntity:dataList){ List<JformGraphreportItemEntity> itemEntities = systemService.findHql(hql0,headEntity.getId()); pageList.add(new JformGraphreportHeadPage(itemEntities,headEntity)); } } map.put(NormalExcelConstants.FILE_NAME,"图表配置"); map.put(NormalExcelConstants.CLASS,JformGraphreportHeadPage.class); map.put(NormalExcelConstants.PARAMS,new ExportParams("图表配置","导出信息")); map.put(NormalExcelConstants.DATA_LIST, pageList); return NormalExcelConstants.JEECG_EXCEL_VIEW; }
Example #5
Source Project: xxpay-master Author: jmdhappy File: MchNotifyController.java License: MIT License | 6 votes |
@RequestMapping("/view.html") public String viewInput(String orderId, ModelMap model) { MchNotify item = null; if(StringUtils.isNotBlank(orderId)) { item = mchNotifyService.selectMchNotify(orderId); } if(item == null) { item = new MchNotify(); model.put("item", item); return "mch_notify/view"; } JSONObject object = (JSONObject) JSON.toJSON(item); if(item.getCreateTime() != null) object.put("createTime", DateUtil.date2Str(item.getCreateTime())); if(item.getUpdateTime() != null) object.put("updateTime", DateUtil.date2Str(item.getUpdateTime())); if(item.getLastNotifyTime() != null) object.put("lastNotifyTime", DateUtil.date2Str(item.getLastNotifyTime())); model.put("item", object); return "mch_notify/view"; }
Example #6
Source Project: FlyCms Author: sunkaifei File: TopicsController.java License: MIT License | 6 votes |
@GetMapping(value = "/topics/{shortUrl}") public String findTopicById(@RequestParam(value = "p", defaultValue = "1") int p,@PathVariable(value = "shortUrl", required = false) String shortUrl, ModelMap modelMap){ if (StringUtils.isBlank(shortUrl)) { return theme.getPcTemplate("404"); } Topic topic = topicService.findTopicByShorturl(shortUrl); if(topic==null){ return theme.getPcTemplate("404"); } if (getUser() != null) { modelMap.addAttribute("user", getUser()); } modelMap.addAttribute("p", p); modelMap.addAttribute("topic", topic); return theme.getPcTemplate("topics/detail"); }
Example #7
Source Project: FlyCms Author: sunkaifei File: PeopleController.java License: MIT License | 6 votes |
@GetMapping(value = "/people/{shortUrl}/follow") public String peopleFollow(@RequestParam(value = "p", defaultValue = "1") int p, @PathVariable(value = "shortUrl", required = false) String shortUrl, ModelMap modelMap){ if (StringUtils.isBlank(shortUrl)) { return theme.getPcTemplate("404"); } User people=userService.findUserByShorturl(shortUrl); if(people==null){ return theme.getPcTemplate("404"); } if (getUser() != null) { modelMap.addAttribute("user", getUser()); } modelMap.addAttribute("p", p); modelMap.addAttribute("count", userService.findUserCountById(people.getUserId())); modelMap.addAttribute("people", people); return theme.getPcTemplate("/people/list_follow"); }
Example #8
Source Project: bbs Author: diyhi File: UserCustomManageAction.java License: GNU Affero General Public License v3.0 | 6 votes |
/** * 用户自定义注册功能项 修改界面显示 */ @RequestMapping(params="method=edit",method=RequestMethod.GET) public String editUI(ModelMap model,Integer id, HttpServletRequest request, HttpServletResponse response) throws Exception { if(id == null){ throw new SystemException("参数错误"); } UserCustom userCustom = userCustomService.findUserCustomById(id); if(userCustom == null){ throw new SystemException("自定义注册功能项不存在"); } if(userCustom.getValue() != null && !"".equals(userCustom.getValue())){ LinkedHashMap<String,String> itemValue_map = JsonUtils.toGenericObject(userCustom.getValue(), new TypeReference<LinkedHashMap<String,String>>(){});//key:选项值 value:选项文本 model.addAttribute("itemValue_map", itemValue_map); } model.addAttribute("userCustom", userCustom); return "jsp/user/edit_userCustom"; }
Example #9
Source Project: Lottery Author: caipiao File: ContentAct.java License: GNU General Public License v2.0 | 6 votes |
@RequestMapping("/content/o_check.do") public String check(String queryStatus, Integer queryTypeId, Boolean queryTopLevel, Boolean queryRecommend, Integer queryOrderBy, Integer[] ids, Integer cid, Integer pageNo, HttpServletRequest request, ModelMap model) { WebErrors errors = validateCheck(ids, request); if (errors.hasErrors()) { return errors.showErrorPage(model); } CmsUser user = CmsUtils.getUser(request); Content[] beans = manager.check(ids, user); for (Content bean : beans) { log.info("check Content id={}", bean.getId()); } return list(queryStatus, queryTypeId, queryTopLevel, queryRecommend, queryOrderBy, cid, pageNo, request, model); }
Example #10
Source Project: youkefu Author: zhangyanbo2007 File: AgentController.java License: Apache License 2.0 | 6 votes |
@RequestMapping(value="/summary") @Menu(type = "apps", subtype = "summary") public ModelAndView summary(ModelMap map , HttpServletRequest request , @Valid String userid , @Valid String agentserviceid, @Valid String agentuserid){ if(!StringUtils.isBlank(userid) && !StringUtils.isBlank(agentuserid)){ // AgentUser agentUser = this.agentUserRepository.findByIdAndOrgi(agentuserid, super.getOrgi(request)) ; // if(agentUser!=null && !StringUtils.isBlank(agentUser.getAgentserviceid())){ // AgentServiceSummary summary = this.serviceSummaryRes.findByAgentserviceidAndOrgi(agentUser.getAgentserviceid(), super.getOrgi(request)) ; // if(summary!=null){ // map.addAttribute("summary", summary) ; // } // } map.addAttribute("tagsSummary", tagRes.findByOrgiAndTagtype(super.getOrgi(request) , UKDataContext.ModelType.SUMMARY.toString())) ; map.addAttribute("userid", userid) ; map.addAttribute("agentserviceid", agentserviceid) ; map.addAttribute("agentuserid", agentuserid) ; } return request(super.createRequestPageTempletResponse("/apps/agent/addsum")) ; }
Example #11
Source Project: spring-cloud-sofastack-samples Author: sofastack File: WebRouterController.java License: Apache License 2.0 | 5 votes |
/** * success * * @return */ @RequestMapping("success") public String success(HttpServletRequest request, ModelMap map) { String orderNo = request.getParameter("orderNo"); boolean isSuccess; String errorMsg = ""; Result<TradingOrder> tradingOrderData = tradingService.queryTradingOrder(orderNo); if (tradingOrderData.isSuccess()) { int account = tradingOrderData.getData().getTargetAccount(); Result<UserDetails> userDetailsData = queryUserDetailByRetryTimes(3, account); if (userDetailsData.isSuccess()) { map.addAttribute("orderNo", orderNo); map.addAttribute("targetAccount", userDetailsData.getData().getUserName()); map.addAttribute("amount", tradingOrderData.getData().getOrderAmount()); map.addAttribute("dateTime", new Date()); isSuccess = true; } else { isSuccess = false; errorMsg = userDetailsData.getErrorMsg(); } } else { isSuccess = false; errorMsg = tradingOrderData.getErrorMsg(); } if (isSuccess) { return "success"; } else { map.addAttribute("errorMsg", errorMsg); return "fail"; } }
Example #12
Source Project: bbs Author: diyhi File: DataBaseManageAction.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * 查询还原进度 * @param model * @return * @throws Exception */ @RequestMapping(params="method=queryResetProgress",method=RequestMethod.GET) @ResponseBody//方式来做ajax,直接返回字符串 public String queryResetProgress(ModelMap model) throws Exception { String resetProgress = mySqlDataManage.getResetProgress(); return resetProgress; }
Example #13
Source Project: sakai Author: sakaiproject File: MainController.java License: Educational Community License v2.0 | 5 votes |
@RequestMapping(value = "/edit", params={"revert"}, method = RequestMethod.POST) public String processRevertEdit(final MessageEntity messageEntity, final BindingResult bindingResult, final ModelMap model) { if (bindingResult.hasErrors()) { return "modified"; } log.debug("processRevertEdit(): MessageEntity = " + messageEntity); MessageBundleProperty property = messageBundleService.getMessageBundleProperty(messageEntity.getId()); if (securityService.isSuperUser()) { messageBundleService.revert(property); } else { throw new SecurityException("Only an admin type user is allowed to revert message bundle properties"); } model.clear(); return "redirect:/modified"; }
Example #14
Source Project: vpn-over-dns Author: AlexandreFenyo File: WebController.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
@RequestMapping(value = "/create-user", method = RequestMethod.POST) public ModelAndView createUserPost( @RequestParam(value = "username", required = false) final String username, @RequestParam(value = "password", required = false) final String password, final ModelMap model) throws GeneralException { log.info("TRACE: createuser;post;" + username + ";" + password + ";"); generalServices.createUser(username, password); log.info("TRACE: createuser;done;" + username + ";" + password + ";"); ModelAndView mav = new ModelAndView("redirect:admin", model); //mav.setViewName("forward:admin"); // est traité en interne, l'URL côté browser ne change pas => pour que l'URL change, il faut utiliser redirect return mav; }
Example #15
Source Project: oslits Author: jht3820 File: Adm2000Controller.java License: GNU General Public License v3.0 | 5 votes |
/** * ADM2000 사용자가 속한 조직목록 조회 Ajax * @param * @return * @exception Exception */ @SuppressWarnings({ "rawtypes" }) @RequestMapping(value="/adm/adm2000/adm2000/selectAdm2000ExistUsrInDeptAjax.do") public ModelAndView selectAdm2000ExistUsrInDeptAjax(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception { try{ // request 파라미터를 map으로 변환 Map<String, String> paramMap = RequestConvertor.requestParamToMap(request, true); //로그인VO 가져오기 HttpSession ss = request.getSession(); LoginVO loginVO = (LoginVO) ss.getAttribute("loginVO"); paramMap.put("licGrpId", loginVO.getLicGrpId()); // 사용자 라이선스 그룹 paramMap.put("regUsrId", loginVO.getUsrId()); // 사용자 ID paramMap.put("regUsrIp", request.getRemoteAddr()); // 사용자 IP // 사용자가 속한 조직목록 조회 List userDeptList = adm2000Service.selectAdm2000ExistUsrInDept(paramMap); model.addAttribute("userDeptList", userDeptList); // 조회 메시지 세팅 model.addAttribute("successYn", "Y"); model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); return new ModelAndView("jsonView"); }catch(Exception e){ Log.error("selectAdm2000ExistUsrInDeptAjax()", e); model.addAttribute("successYn", "N"); model.addAttribute("message", egovMessageSource.getMessage("fail.common.select")); return new ModelAndView("jsonView"); } }
Example #16
Source Project: oslits Author: jht3820 File: Prj3000Controller.java License: GNU General Public License v3.0 | 5 votes |
/** * Prj3000 확정 산출물 전체 다운로드 * 산출물 파일 업로드 * @param * @return * @exception Exception */ @SuppressWarnings("rawtypes") @RequestMapping(value="/prj/prj3000/prj3000/selectPrj3000MenuTreeZipDownload.do") public ModelAndView selectPrj3000MenuTreeZipDownload(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception { try{ // request 파라미터를 map으로 변환 Map<String, String> paramMap = RequestConvertor.requestParamToMapAddSelInfo(request, true); HttpSession ss = request.getSession(); paramMap.put("prjId", (String)ss.getAttribute("selPrjId")); List<Map> docMenuList = prj3000Service.selectPrj3000MenuTree(paramMap); model.addAttribute("docMenuList", docMenuList); //등록 성공 메시지 세팅 model.addAttribute("message", egovMessageSource.getMessage("success.common.select")); return new ModelAndView("jsonView"); } catch(Exception ex){ Log.error("selectPrj3000MenuTreeZipDownload()", ex); //업로드 실패 메시지 세팅 및 저장 성공여부 세팅 model.addAttribute("saveYN", "N"); model.addAttribute("message", egovMessageSource.getMessage("fail.common.select")); return new ModelAndView("jsonView"); } }
Example #17
Source Project: spring4-understanding Author: langtianya File: ModelResultMatchers.java License: Apache License 2.0 | 5 votes |
private int getErrorCount(ModelMap model) { int count = 0; for (Object value : model.values()) { if (value instanceof Errors) { count += ((Errors) value).getErrorCount(); } } return count; }
Example #18
Source Project: LuckyFrameWeb Author: seagull1985 File: ProjectProtocolTemplateController.java License: GNU Affero General Public License v3.0 | 5 votes |
/** * 新增协议模板管理 */ @GetMapping("/add") public String add(ModelMap mmap) { List<Project> projects=projectService.selectProjectAll(0); mmap.put("projects", projects); if(StringUtils.isNotEmpty(ShiroUtils.getProjectId())){ mmap.put("defaultProjectId", ShiroUtils.getProjectId()); } return "testmanagmt/projectProtocolTemplate/add"; }
Example #19
Source Project: attic-rave Author: apache File: ProfileControllerTest.java License: Apache License 2.0 | 5 votes |
@Test public void viewPerson_userid() { //creating a mock user final UserImpl user = new UserImpl(); final ModelMap model = new ModelMap(); final int modelSize = 4; final String username="canonical"; user.setUsername(username); user.setId(USER_ID); String userProfile = new String(ModelKeys.USER_PROFILE); Page personProfile = new PageImpl(); PageLayout pageLayout = new PageLayoutImpl(); pageLayout.setCode(VALID_PAGE_LAYOUT_CODE); personProfile.setPageLayout(pageLayout); List<Person> personObjects = new ArrayList<Person>(); expect(userService.getUserById(USER_ID)).andReturn(user).once(); expect(pageService.getPersonProfilePage(user.getId())).andReturn(personProfile); expect(userService.getFriendRequestsReceived(username)).andReturn(personObjects); replay(userService, pageService); String view = profileController.viewProfile(USER_ID, model, null, response); //assert that the model is not null assertThat(model, CoreMatchers.notNullValue()); //assert that the model size is four assertThat(model.size(), CoreMatchers.equalTo(modelSize)); //assert that the model does contain an attribute associated with the authenticated user after setUpForm() is called assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true)); //assert that the model does not contain authenticated user as null assertThat(model.get(userProfile), CoreMatchers.notNullValue()); assertThat(view, is(ViewNames.PERSON_PROFILE + "." + VALID_PAGE_LAYOUT_CODE)); verify(userService, pageService); }
Example #20
Source Project: oslits Author: jht3820 File: Req4100Controller.java License: GNU General Public License v3.0 | 5 votes |
/** * Req4100 화면 이동(이동시 요구사항 분류 정보 목록 조회) * @param * @return * @exception Exception */ @SuppressWarnings({ "rawtypes" }) @RequestMapping(value="/req/req4000/req4100/selectReq4100View.do") public String selectReq4100View(@ModelAttribute("req4100VO") Req4100VO req4100VO, HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception { // request 파라미터를 map으로 변환 Map<String, String> paramMap = RequestConvertor.requestParamToMapAddSelInfo(request, true); paramMap.put("prjId", request.getSession().getAttribute("selPrjId").toString()); //프로젝트 단건 조회 Map prjInfo = (Map)prj1000Service.selectPrj1000Info(paramMap); model.addAttribute("currPrjInfo",prjInfo); return "/req/req4000/req4100/req4100"; }
Example #21
Source Project: roncoo-jui-springboot Author: roncoo File: SysRoleController.java License: Apache License 2.0 | 5 votes |
@RequestMapping(value = "/list") public void list(@RequestParam(value = "pageNum", defaultValue = "1") int pageCurrent, @RequestParam(value = "numPerPage", defaultValue = "20") int pageSize, @ModelAttribute SysRoleQO qo, ModelMap modelMap) { modelMap.put("page", service.listForPage(pageCurrent, pageSize, qo)); modelMap.put("pageCurrent", pageCurrent); modelMap.put("pageSize", pageSize); modelMap.put("bean", qo); modelMap.put("statusIdEnums", StatusIdEnum.values()); }
Example #22
Source Project: Jisonami2 Author: jisonami File: BlogController.java License: Apache License 2.0 | 5 votes |
@RequestMapping("ViewForward.do") public String viewForward(String blogId, ModelMap model){ Blog blog = null; blog = blogService.queryById(blogId); if(blog!=null){ model.put("blog", blog); } String blogTypeIds = blog.getBlogType(); String blogTypes = ""; List<String> blogTypeIdList = Arrays.asList(blogTypeIds.split(",")); for(int i=0;i<blogTypeIdList.size();i++){ String blogTypeId = blogTypeIdList.get(i); BlogType blogType = null; blogType = blogTypeService.queryById(blogTypeId); if(i < blogTypeIdList.size()-1){ blogTypes = blogTypes + blogType.getName() + ","; } else { blogTypes = blogTypes + blogType.getName(); } } if(blogTypeIds!=null && !"".equals(blogTypeIds)){ model.put("blogTypeIds", blogTypeIds); } if(blogTypes!=null && !"".equals(blogTypes)){ model.put("blogTypes", blogTypes); } return "/blog/view"; }
Example #23
Source Project: youkefu Author: zhangyanbo2007 File: SettingRoleController.java License: Apache License 2.0 | 5 votes |
/** * 引入角色,跳转引入角色页面 * @param map * @param request * @return */ @RequestMapping({"/role/add"}) @Menu(type="apps", subtype="sales") public ModelAndView roleadd(ModelMap map , HttpServletRequest request){ map.addAttribute("oragnList",organRes.findByOrgi(super.getOrgi(request))); map.addAttribute("roleList",roleRes.findByOrgi(super.getOrgi(request))); map.addAttribute("calloutroleList",callOutRoleRes.findByOrgi(super.getOrgi(request))); return request(super.createRequestPageTempletResponse("/apps/setting/role/addrole")); }
Example #24
Source Project: oslits Author: jht3820 File: Adm1000Controller.java License: GNU General Public License v3.0 | 5 votes |
/** * Adm1000 메뉴정보 등록(단건) AJAX * 메뉴정보 등록후 등록 정보 결과 및 정보를 화면으로 리턴한다. * @param * @return * @exception Exception */ @SuppressWarnings({ "rawtypes", "unchecked" }) @RequestMapping(value="/adm/adm1000/adm1000/insertAdm1000MenuInfoAjax.do") public ModelAndView insertAdm1000MenuInfoAjax(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception { try{ // request 파라미터를 map으로 변환 Map<String, String> paramMap = RequestConvertor.requestParamToMap(request, true); // 메뉴 등록 Map<String, String> menuInfoMap = (Map) adm1000Service.insertAdm1000MenuInfo(paramMap); //등록 성공 메시지 세팅 model.addAttribute("message", egovMessageSource.getMessage("success.common.insert")); return new ModelAndView("jsonView", menuInfoMap); } catch(Exception ex){ Log.error("selectAdm1000MenuInfoAjax()", ex); //조회실패 메시지 세팅 및 저장 성공여부 세팅 model.addAttribute("saveYN", "N"); model.addAttribute("message", egovMessageSource.getMessage("fail.common.insert")); return new ModelAndView("jsonView"); } }
Example #25
Source Project: spring4-understanding Author: langtianya File: ViewNameMethodReturnValueHandlerTests.java License: Apache License 2.0 | 5 votes |
@Test public void returnViewNameRedirect() throws Exception { ModelMap redirectModel = new RedirectAttributesModelMap(); this.mavContainer.setRedirectModel(redirectModel); this.handler.handleReturnValue("redirect:testView", this.param, this.mavContainer, this.webRequest); assertEquals("redirect:testView", this.mavContainer.getViewName()); assertSame(redirectModel, this.mavContainer.getModel()); }
Example #26
Source Project: Lottery Author: caipiao File: ResourceAct.java License: GNU General Public License v2.0 | 5 votes |
@RequestMapping(value = "/resource/o_swfupload.do", method = RequestMethod.POST) public void swfUpload( String root, @RequestParam(value = "Filedata", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IllegalStateException, IOException { resourceMng.saveFile(root, file); model.addAttribute("root", root); log.info("file upload seccess: {}, size:{}.", file .getOriginalFilename(), file.getSize()); ResponseUtils.renderText(response, ""); }
Example #27
Source Project: jeewx-boot Author: zhangdaiscott File: WeixinAutoresponseController.java License: Apache License 2.0 | 5 votes |
/** * 跳转到添加页面 * @return */ @RequestMapping(value = "/toAdd",method ={RequestMethod.GET, RequestMethod.POST}) public void toAddDialog(HttpServletRequest request,HttpServletResponse response,ModelMap model)throws Exception{ VelocityContext velocityContext = new VelocityContext(); String viewName = "weixin/back/weixinAutoresponse-add.vm"; ViewVelocity.view(request,response,viewName,velocityContext); }
Example #28
Source Project: Lottery Author: caipiao File: CmsAdvertisingAct.java License: GNU General Public License v2.0 | 5 votes |
@RequestMapping("/advertising/v_add.do") public String add(HttpServletRequest request, ModelMap model) { CmsSite site = CmsUtils.getSite(request); List<CmsAdvertisingSpace> adspaceList = cmsAdvertisingSpaceMng .getList(site.getId()); model.addAttribute("adspaceList", adspaceList); return "advertising/add"; }
Example #29
Source Project: spring-blog Author: woemler File: BlogController.java License: MIT License | 5 votes |
@RequestMapping(value="/tags/{tag}", method=RequestMethod.GET) public String tagDetails(ModelMap map, @PathVariable("tag") String tag){ List<BlogPost> blogPosts = blogRepository.findByTags(tag); map.addAttribute("tag", tag); map.addAttribute("blogPosts", blogPosts); return "tagDetails"; }
Example #30
Source Project: spring4-understanding Author: langtianya File: ModelAndViewMethodReturnValueHandlerTests.java License: Apache License 2.0 | 5 votes |
@Test public void handleRedirectAttributesWithoutRedirect() throws Exception { RedirectAttributesModelMap redirectAttributes = new RedirectAttributesModelMap(); mavContainer.setRedirectModel(redirectAttributes); ModelAndView mav = new ModelAndView(); handler.handleReturnValue(mav, returnParamModelAndView, mavContainer, webRequest); ModelMap model = mavContainer.getModel(); assertEquals(null, mavContainer.getView()); assertTrue(mavContainer.getModel().isEmpty()); assertNotSame("RedirectAttributes should not be used if controller doesn't redirect", redirectAttributes, model); }