Java Code Examples for org.springframework.ui.ModelMap#put()

The following examples show how to use org.springframework.ui.ModelMap#put() . 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: OnlineUserController.java    From youkefu with Apache License 2.0 6 votes vote down vote up
@RequestMapping("/online/chatmsg")
  @Menu(type = "service" , subtype = "chatmsg" , admin= true)
  public ModelAndView onlinechat(ModelMap map , HttpServletRequest request , String id , String title) {
AgentService agentService = agentServiceRes.getOne(id) ; 
AgentUser curragentuser = agentUserRes.findByUseridAndOrgi(agentService.getUserid(), super.getOrgi(request)) ;

map.put("curAgentService", agentService) ;
map.put("curagentuser", curragentuser) ;
if(!StringUtils.isBlank(title)){
	map.put("title", title) ;
}

map.addAttribute("tagsSummary", tagRes.findByOrgiAndTagtype(super.getOrgi(request) , UKDataContext.ModelType.SUMMARY.toString())) ;
if(agentService!=null){
	Page<AgentServiceSummary> summaryList = this.serviceSummaryRes.findByOrgiAndUserid(super.getOrgi(request), agentService.getUserid() , new PageRequest(0, super.getPs(request), Sort.Direction.DESC, new String[] { "createtime" }));
	map.addAttribute("summaryList", summaryList) ;
}

map.put("agentUserMessageList", chatMessageRepository.findByAgentserviceidAndOrgi(agentService.getId() , super.getOrgi(request), new PageRequest(0, 50, Direction.DESC , "updatetime")));

      return request(super.createRequestPageTempletResponse("/apps/service/online/chatmsg"));
  }
 
Example 2
Source File: NamesrvAction.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "/getProjectGroup.do", method = { RequestMethod.GET, RequestMethod.POST })
public String getProjectGroup(ModelMap map, HttpServletRequest request,
        @RequestParam(required = false) String ip, @RequestParam(required = false) String project) {
    Collection<Option> options = namesrvService.getOptionsForGetProjectGroup();
    putPublicAttribute(map, "getProjectGroup", options, request);
    try {
        if (request.getMethod().equals(GET)) {

        }
        else if (request.getMethod().equals(POST)) {
            checkOptions(options);
            String text = namesrvService.getProjectGroup(ip, project);
            map.put("resultText", text);
        }
        else {
            throwUnknowRequestMethodException(request);
        }
    }
    catch (Throwable e) {
        putAlertMsg(e, map);
    }
    return TEMPLATE;
}
 
Example 3
Source File: TodoController.java    From docker-crash-course with MIT License 5 votes vote down vote up
@RequestMapping(value = "/list-todos", method = RequestMethod.GET)
public String showTodos(ModelMap model) {
	String name = getLoggedInUserName(model);
	model.put("todos", repository.findByUser(name));
	//model.put("todos", service.retrieveTodos(name));
	return "list-todos";
}
 
Example 4
Source File: PodcastIdentifierController.java    From podcastpedia-web with MIT License 5 votes vote down vote up
/**
 * Add an empty searchData object to the model
 */
@ModelAttribute
public void addDataToModel(ModelMap model) {
	SearchData dataForSearchBar = new SearchData();
	dataForSearchBar.setSearchMode("natural");
	dataForSearchBar.setCurrentPage(1);
	dataForSearchBar.setQueryText(null);
	dataForSearchBar.setNumberResultsPerPage(10);
	model.put("advancedSearchData", dataForSearchBar);
}
 
Example 5
Source File: SysOperlogController.java    From ruoyiplus with MIT License 5 votes vote down vote up
@RequiresPermissions("monitor:operlog:detail")
@GetMapping("/detail/{operId}")
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
{
    mmap.put("operLog", operLogService.selectOperLogById(operId));
    return prefix + "/detail";
}
 
Example 6
Source File: ReportDesignController.java    From youkefu with Apache License 2.0 5 votes vote down vote up
/**
 * 修改指标
 * 
 * @param map
 * @param request
 * @return
 */
@RequestMapping("/columnedit")
@Menu(type = "report", subtype = "reportdesign")
public ModelAndView columnedit(ModelMap map, HttpServletRequest request, @Valid String id) {
	if (!StringUtils.isBlank(id)) {
		ColumnProperties col = columnPropertiesRepository.findByIdAndOrgi(id, super.getOrgi(request));
		if (col != null) {
			map.put("col", col) ;
		}
	}
	return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/measureedit"));
}
 
Example 7
Source File: AddLinkController.java    From conference-app with MIT License 5 votes vote down vote up
@RequestMapping(method = RequestMethod.GET)
public void setupForm(ModelMap modelMap, HttpServletRequest request) {
    String sessionId = request.getParameter("sessionId");
    Session session = sessionDao.getSessionById(sessionId);

    LinkFormData linkFormData = new LinkFormData();

    modelMap.put("linkFormData", linkFormData);
    modelMap.put("sessionTitle", session.getTitle());
}
 
Example 8
Source File: ProfileController.java    From v-mock with MIT License 5 votes vote down vote up
/**
 * 个人信息
 */
@GetMapping
public String profile(ModelMap mmap) {
    User user = getSysUser();
    mmap.put("user", user);
    return PREFIX + "/profile";
}
 
Example 9
Source File: ProjectPlanCaseController.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 5 votes vote down vote up
@RequiresPermissions("testmanagmt:projectPlan:view")
@GetMapping("/{planId}")
public String projectPlanCase(@PathVariable("planId") Integer planId, ModelMap mmap)
{
	ProjectPlan projectPlan = projectPlanService.selectProjectPlanById(planId);
       ProjectCaseModule projectCaseModule = projectCaseModuleService.selectProjectCaseModuleParentZeroByProjectId(projectPlan.getProjectId());
       mmap.put("projectCaseModule", projectCaseModule);
    return "testmanagmt/projectPlan/projectPlanCase";
}
 
Example 10
Source File: EmailAccountInfoController.java    From roncoo-adminlte-springmvc with Apache License 2.0 5 votes vote down vote up
/**
 * 编辑
 * 
 * @param id
 * @param modelMap
 */
@RequestMapping(value = EDIT, method = RequestMethod.GET)
public void edit(@RequestParam Long id, ModelMap modelMap) {
	Result<List<RcDataDictionaryList>> dictionaryListResult = biz.listByFieldCode(FIELDCODE);
	Result<RcEmailAccountInfo> emailAccountResult = biz.query(id);
	if (dictionaryListResult.isStatus()) {
		modelMap.put("selectList", dictionaryListResult.getResultData());
	}
	if (emailAccountResult.isStatus()) {
		modelMap.put("info", emailAccountResult.getResultData());
	}
}
 
Example 11
Source File: SysIndexController.java    From supplierShop with MIT License 5 votes vote down vote up
@GetMapping("/index")
public String index(ModelMap mmap)
{
    // 取身份信息
    SysUser user = ShiroUtils.getSysUser();
    // 根据用户id取出菜单
    List<SysMenu> menus = menuService.selectMenusByUser(user);
    mmap.put("menus", menus);
    mmap.put("user", user);
    mmap.put("copyrightYear", Global.getCopyrightYear());
    mmap.put("demoEnabled", Global.isDemoEnabled());
    return "index";
}
 
Example 12
Source File: UserAdminController.java    From FlyCms with MIT License 5 votes vote down vote up
@GetMapping(value = "/assignPermissions/{id}")
public String assignPermissions(@PathVariable Long id, ModelMap modelMap){
    UserGroup group = userGroupService.findUserGroupByid(id);
    List<UserPermission> permissionList = userPermissionService.getAllPermissions();
    LinkedHashMap<String, List<UserPermission>> permissionMap = userPermissionService.groupByController(permissionList);
    modelMap.put("group", group);
    modelMap.put("permissionMap", permissionMap);
    modelMap.addAttribute("admin", getAdminUser());
    return theme.getAdminTemplate("user/assign_permissions");
}
 
Example 13
Source File: LimitController.java    From hasting with MIT License 5 votes vote down vote up
/**
 * 限流列表
 * @param limit
 * @param offset
 * @param model
 * @return
 */
@RequestMapping(value="/list",method = RequestMethod.GET)
public String limitIndex(@RequestParam(value="limit",required = false,defaultValue = "50") int limit,
                   @RequestParam(value="offset",required = false,defaultValue = "0") int offset,ModelMap model){
    List<AppInfo> appList = appService.getAppList();
    model.put("appes",appList);
    model.put("limit",limit);
    model.put("offset",offset);
    model.put("total",appList.size());
    return "limit_list";
}
 
Example 14
Source File: AdminOrderController.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
/**
 * 查看订单
 */
@RequiresPermissions("order:view")
@RequestMapping(value = "/view")
public String view(@ModelAttribute Order order, HttpServletRequest request, HttpServletResponse response, ModelMap m) {
	List<OrderItem> orderItemList = itemService.findByOrderId(order);
	m.put("orderItemList", orderItemList);
	return "modules/shop/admin/order/view";
}
 
Example 15
Source File: SecureController.java    From Mastering-Spring-5.0 with MIT License 4 votes vote down vote up
@RequestMapping(value = "/secure/welcome")
public String welcome(ModelMap map) {
	map.put("name", getLoggedInUserName());
	return "secure-welcome-page";
}
 
Example 16
Source File: Stm4000Controller.java    From oslits with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Stm4000 프로젝트를 수정한다
 * @param
 * @return update row, 프로젝트ID
 * @exception Exception
 */
   @SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value="/stm/stm4000/stm4000/updateStm4000PrjInfoAjax.do")
   public ModelAndView updateStm4000PrjInfoAjax(HttpServletRequest request, HttpServletResponse response, ModelMap model ) throws Exception {
   	try{
   		// request 파라미터를 map으로 변환
       	Map<String, String> paramMap = RequestConvertor.requestParamToMap(request, true);
       	
       	// 프로젝트 약어
   		String prjAcrmStr = paramMap.get("prjAcrm");
   		
   		// 프로젝트 약어가 있을 경우
   		if(prjAcrmStr != null){
   			// Map에 프로젝트 약어 추가
       		paramMap.put("prjAcrm", prjAcrmStr.toUpperCase());
   		}
       	
       	// 프로젝트 수정
       	int updateCnt = prj1000Service.updatePrj1000Ajax(paramMap);
       	
       	// 프로젝트 ID와 프로젝트 수정 count 값을 세팅
       	model.put("prjId", paramMap.get("prjId"));
       	model.put("updateCnt", updateCnt);
       	// 수정 성공여부 및 수정 성공 메시지 세팅
       	model.addAttribute("errorYn", "N");
       	model.addAttribute("message", egovMessageSource.getMessage("success.common.update"));
       	
       	//세션 정보 가져오기
		HttpSession ss = request.getSession();
		// LoginVO를 가져온다
		LoginVO loginVO = (LoginVO) ss.getAttribute("loginVO");
		
		// 사용자 ID를 가져온다.
		String usrId = (String)loginVO.getUsrId();
		paramMap.put("usrId", usrId);
		
		// 세션 재세팅을 위한 프로젝트 목록 불러올 때 프로젝트 그룹값 Map에서 제거한다.
		// 그렇지 않으면 단위 프로젝트만 조회되어 세션에 세팅된다.
		paramMap.remove("prjGrpCd");
		
       	// 사용자 권한있는 프로젝트 목록 조회
		List<Map> prjList = (List)prj1000Service.selectPrj1000View(paramMap);

   		// 세션에 있는 기존 프로젝트 목록 제거
   		ss.removeAttribute("prjList");
   		
   		// 조회한 권한있는 프로젝트 목록을 세션에 재세팅
   		ss.setAttribute("prjList", prjList);
   		
       	return new ModelAndView("jsonView", model);
   	}
   	catch(Exception ex){
   		Log.error("updateStm4000PrjInfoAjax()", ex);
         	// 수정 실패여부 및 수정 실패 메시지 세팅
       	model.addAttribute("errorYn", "Y");
   		model.addAttribute("message", egovMessageSource.getMessage("fail.common.update"));
   		return new ModelAndView("jsonView");
   	}
   }
 
Example 17
Source File: BasicModelMapController.java    From Mastering-Spring-5.0 with MIT License 4 votes vote down vote up
@RequestMapping(value = "/welcome-model-map")
public String welcome(ModelMap model) {
	model.put("name", "XYZ");
	return "welcome-model-map";
}
 
Example 18
Source File: SysNoticeController.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
/**
 * 修改公告
 */
@GetMapping("/edit/{noticeId}")
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) {
    mmap.put("notice", noticeService.selectNoticeById(noticeId));
    return prefix + "/edit";
}
 
Example 19
Source File: DatabaseController.java    From youkefu with Apache License 2.0 4 votes vote down vote up
@RequestMapping("/index")
@Menu(type = "setting" , subtype = "database" , admin= true)
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String dicid) {
	map.put("databaseList", databaseRes.findByOrgi(super.getOrgi(request) , new PageRequest(super.getP(request), super.getPs(request)))) ;
	return request(super.createAppsTempletResponse("/apps/business/database/index"));
}
 
Example 20
Source File: WebSocketController.java    From springboot-learn with MIT License 4 votes vote down vote up
@GetMapping(value = "chat/{sid}")
public String chat(ModelMap modelMap, @PathVariable String sid) {
    modelMap.put("sid", sid);

    return "chat";
}