当前位置: 首页>>代码示例>>Java>>正文


Java ModelMap.put方法代码示例

本文整理汇总了Java中org.springframework.ui.ModelMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java ModelMap.put方法的具体用法?Java ModelMap.put怎么用?Java ModelMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.ui.ModelMap的用法示例。


在下文中一共展示了ModelMap.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: viewInput

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("/view.html")
public String viewInput(String transOrderId, ModelMap model) {
    TransOrder item = null;
    if(StringUtils.isNotBlank(transOrderId)) {
        item = transOrderService.selectTransOrder(transOrderId);
    }
    if(item == null) {
        item = new TransOrder();
        model.put("item", item);
        return "trans_order/view";
    }
    JSONObject object = (JSONObject) JSON.toJSON(item);
    if(item.getTransSuccTime() != null) object.put("transSuccTime", DateUtil.date2Str(item.getTransSuccTime()));
    if(item.getExpireTime() != null) object.put("expireTime", DateUtil.date2Str(item.getExpireTime()));
    if(item.getAmount() != null) object.put("amount", AmountUtil.convertCent2Dollar(item.getAmount()+""));
    model.put("item", object);
    return "trans_order/view";
}
 
开发者ID:jmdhappy,项目名称:xxpay-master,代码行数:19,代码来源:TransOrderController.java

示例2: setModelMap

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
/** 设置响应代码 */
protected ResponseEntity<ModelMap> setModelMap(ModelMap modelMap, HttpCode code, Object data) {
	Map<String, Object> map = InstanceUtil.newLinkedHashMap();
	map.putAll(modelMap);
	modelMap.clear();
	for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext();) {
		String key = iterator.next();
		if (!key.startsWith("org.springframework.validation.BindingResult") && !key.equals("void")) {
			modelMap.put(key, map.get(key));
		}
	}
	if (data != null) {
		if (data instanceof Page) {
			Page<?> page = (Page<?>) data;
			modelMap.put("data", page.getRecords());
			modelMap.put("current", page.getCurrent());
			modelMap.put("size", page.getSize());
			modelMap.put("pages", page.getPages());
			modelMap.put("total", page.getTotal());
			modelMap.put("iTotalRecords", page.getTotal());
			modelMap.put("iTotalDisplayRecords", page.getTotal());
		} else if (data instanceof List<?>) {
			modelMap.put("data", data);
			modelMap.put("iTotalRecords", ((List<?>) data).size());
			modelMap.put("iTotalDisplayRecords", ((List<?>) data).size());
		} else {
			modelMap.put("data", data);
		}
	}
	modelMap.put("httpCode", code.value());
	modelMap.put("msg", code.msg());
	modelMap.put("timestamp", System.currentTimeMillis());
	return ResponseEntity.ok(modelMap);
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:35,代码来源:BaseController.java

示例3: Home

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping(value = "/home", method = RequestMethod.GET)
public String Home(ModelMap map, @RequestParam(name = "species",
        required = false, defaultValue = "All") String species)
        throws InterruptedException {

    Zoo z = Zoo.getInstance();

    map.put("z", z);
    map.put("z", z.getAllAnimals());
    map.put("species", species);
    map.put("table", z.getAllAnimalsBySpecies(species));

    if (species.equals("All")) {
        z.getAllAnimals();
        map.put("table", z.getAllAnimals());
    } else {
        z.getAllAnimalsBySpecies(species);
        map.put("table", z.getAllAnimalsBySpecies(species));
    }

    map.put("getName", z.getName());

    return "index";
}
 
开发者ID:marc0tjevp,项目名称:Animal-Kingdom,代码行数:25,代码来源:TestController.java

示例4: performancePortal

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("performance")
public ModelAndView performancePortal(ModelMap modelMap, HttpSession session,
		@RequestParam(value = "serviceName", required = false) String serviceNamePort,
		@RequestParam(value = "project", required = false) String project,
		@RequestParam(value = "life", required = false) String life,
		@RequestParam(value = CSAP.HOST_PARAM, required = false) String hostName)
		throws IOException {

	setCommonAttributes( modelMap, session, "Analytics Portal" );

	modelMap.put( "project", project );
	modelMap.put( "life", life );

	modelMap.addAttribute( "metricLabels", buildMetricLabels()  );

	return new ModelAndView( "performance/perf-main" );
}
 
开发者ID:csap-platform,项目名称:csap-core,代码行数:18,代码来源:HostPortal.java

示例5: uploadImage2Ftp

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("/image")
@ApiOperation(value = "上传图片")
public Object uploadImage2Ftp(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) {
	List<String> fileNames = UploadUtil.uploadImage(request, false);
	if (fileNames.size() > 0) {
		List<String> resultList = InstanceUtil.newArrayList();
		for (int i = 0; i < fileNames.size(); i++) {
			String filePath = UploadUtil.getUploadDir(request) + fileNames.get(i);
			String objectId = UUID.randomUUID().toString().replaceAll("-", "");
			String file = UploadUtil.remove2DFS("image", objectId, filePath).getRemotePath();
			resultList.add(file);
		}
		modelMap.put("fileNames", resultList);
		return setSuccessModelMap(modelMap);
	} else {
		setModelMap(modelMap, HttpCode.BAD_REQUEST);
		modelMap.put("msg", "请选择要上传的文件!");
		return modelMap;
	}
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:21,代码来源:UploadController.java

示例6: list

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@GetMapping
public String list(ModelMap model){
    List<Person> persons = personMapper.getPersons();
    model.put("persons", persons);

    return "list";
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Cookbook,代码行数:8,代码来源:PersonContoller.java

示例7: sinaCallback

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("callback/sina")
@ApiOperation(value = "微博登录回调", httpMethod = "GET")
public String sinaCallback(HttpServletRequest request, ModelMap modelMap) {
	String host = request.getHeader("host");
	try {
		String code = request.getParameter("code");
		if (StringUtils.isNotBlank(code)) {// 如果不为空
			// 获取token和uid
			JSONObject json = ThirdPartyLoginHelper.getSinaTokenAndUid(code, host);
			String uid = json.getString("uid");
			if (StringUtils.isNotBlank(uid)) {// 如果uid存在
				// 获取第三方用户信息存放到session中
				ThirdPartyUser thirdUser = ThirdPartyLoginHelper.getSinaUserinfo(json.getString("access_token"),
						uid);
				thirdUser.setProvider("SINA");
				thirdPartyLogin(request, thirdUser);
				// 跳转到登录成功界面
				modelMap.put("retUrl", Resources.THIRDPARTY.getString("third_login_success"));
			} else {// 如果未获取到OpenID
					// 跳转到登录成功界面
				modelMap.put("retUrl", "-1");
			}
		} else {// 如果没有返回令牌,则直接返回到登录页面
				// 跳转到登录成功界面
			modelMap.put("retUrl", "-1");
		}
	} catch (Exception e) {
		// 跳转到登录失败界面
		modelMap.put("retUrl", "-1");
		e.printStackTrace();
	}

	return "/sns/redirect";
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:35,代码来源:ThirdPartyLoginController.java

示例8: homeHandler

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("/home.do")
public String homeHandler(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws ServletException {

    SessionUser sessionUser = (SessionUser) this.getSessionObject(request, SysConstants.SESSION_USER_KEY);
    model.put("sessionUser", sessionUser);
    Map<String, Object> param = new HashMap<String, Object>();

    List<SeRole> seRoleList = sessionUser.getSeRoleList();

    if (seRoleList != null && seRoleList.size() > 0) {
        param.put("seRoleList", seRoleList);
        List<SeMenu> listUserMenu = seRolemenuService.listSeMenuByUsercode(param);

        if (listUserMenu != null && listUserMenu.size() > 0) {
            // 拼接菜单
            SeMenu rootSeMenu = listUserMenu.remove(0);
            MenuTree tree = new MenuTree(rootSeMenu,listUserMenu);
            model.put("listUserMenu", tree.buildTree());
        }

        for(SeMenu seMenu : listUserMenu){
            if(!Utils.strIsNull(seMenu.getSourceurl())){
                model.put("firstMenu", seMenu);
                break;
            }
        }

    }
    return "page/home";
}
 
开发者ID:JiaXiaohei,项目名称:ssm-web,代码行数:31,代码来源:PageController.java

示例9: permission

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@ApiOperation(value = "用户权限")
@RequiresPermissions("upms:user:permission")
@RequestMapping(value = "/permission/{id}", method = RequestMethod.GET)
public String permission(@PathVariable("id") int id, ModelMap modelMap) {
    UpmsUser user = upmsUserService.selectByPrimaryKey(id);
    modelMap.put("user", user);
    return "/manage/user/permission.jsp";
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:9,代码来源:UpmsUserController.java

示例10: setModelMap

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
/** 设置响应代码 */
protected ResponseEntity<ModelMap> setModelMap(ModelMap modelMap, HttpCode code, Object data) {
	Map<String, Object> map = InstanceUtil.newLinkedHashMap();
	map.putAll(modelMap);
	modelMap.clear();
	for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext();) {
		String key = iterator.next();
		if (!key.startsWith("org.springframework.validation.BindingResult") && !key.equals("void")) {
			modelMap.put(key, map.get(key));
		}
	}
	if (data != null) {
		if (data instanceof Page) {
			Page<?> page = (Page<?>) data;
			modelMap.put("data", page.getRecords());
			modelMap.put("current", page.getCurrent());
			modelMap.put("size", page.getSize());
			modelMap.put("pages", page.getPages());
			modelMap.put("iTotalRecords", page.getTotal());
			modelMap.put("iTotalDisplayRecords", page.getTotal());
		} else if (data instanceof List<?>) {
			modelMap.put("data", data);
			modelMap.put("iTotalRecords", ((List<?>) data).size());
			modelMap.put("iTotalDisplayRecords", ((List<?>) data).size());
		} else {
			modelMap.put("data", data);
		}
	}
	modelMap.put("httpCode", code.value());
	modelMap.put("msg", code.msg());
	modelMap.put("timestamp", System.currentTimeMillis());
	return ResponseEntity.ok(modelMap);
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:34,代码来源:AbstractController.java

示例11: validUser

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String validUser(String loginName, String password, HttpServletRequest request, HttpServletResponse response, ModelMap model) {
	logger.debug("login {loginName:" + loginName + ",password:" + password + "}");
	User user = userService.getUserByLoginName(loginName);
	if (user != null && user.getPassword().equals(password)) {
		model.put("message", "登录成功");
	} else {
		model.put("message", "用户验证失败");
	}
	model.addAttribute("loginName", loginName);
	return "test";
}
 
开发者ID:wz12406,项目名称:accumulate,代码行数:13,代码来源:TestController.java

示例12: qqCallback

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping("/callback/qq")
public String qqCallback(HttpServletRequest request, ModelMap modelMap) {
	String host = request.getHeader("host");
	try {
		String code = request.getParameter("code");
		if (StringUtils.isNotBlank(code)) {// 如果不为空
			// 获取token和openid
			Map<String, String> map = ThirdPartyLoginHelper.getQQTokenAndOpenid(code, host);
			String openId = map.get("openId");
			if (StringUtils.isNotBlank(openId)) {// 如果openID存在
				// 获取第三方用户信息存放到session中
				ThirdPartyUser thirdUser = ThirdPartyLoginHelper.getQQUserinfo(map.get("access_token"), openId);
				thirdUser.setProvider("QQ");
				thirdPartyLogin(request, thirdUser);
				// 跳转到登录成功界面
				modelMap.put("retUrl", Resources.THIRDPARTY.getString("third_login_success"));
			} else {// 如果未获取到OpenID
				modelMap.put("retUrl", "-1");
			}
		} else {// 如果没有返回令牌,则直接返回到登录页面
			modelMap.put("retUrl", "-1");
		}
	} catch (Exception e) {
		modelMap.put("retUrl", "-1");
		e.printStackTrace();
	}

	return "/sns/redirect";
}
 
开发者ID:babymm,项目名称:mumu,代码行数:30,代码来源:ThirdPartyLoginController.java

示例13: update

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@ApiOperation(value = "修改标签")
@RequiresPermissions("cms:tag:update")
@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
public String update(@PathVariable("id") int id, ModelMap modelMap) {
	CmsTag tag = cmsTagService.selectByPrimaryKey(id);
	modelMap.put("tag", tag);
	return "/manage/tag/update.jsp";
}
 
开发者ID:ChangyiHuang,项目名称:shuzheng,代码行数:9,代码来源:CmsTagController.java

示例14: role

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@ApiOperation(value = "用户角色")
@RequiresPermissions("upms:user:role")
@RequestMapping(value = "/role/{id}", method = RequestMethod.GET)
public String role(@PathVariable("id") int id, ModelMap modelMap) {
    // 所有角色
    List<UpmsRole> upmsRoles = upmsRoleService.selectByExample(new UpmsRoleExample());
    // 用户拥有角色
    UpmsUserRoleExample upmsUserRoleExample = new UpmsUserRoleExample();
    upmsUserRoleExample.createCriteria()
            .andUserIdEqualTo(id);
    List<UpmsUserRole> upmsUserRoles = upmsUserRoleService.selectByExample(upmsUserRoleExample);
    modelMap.put("upmsRoles", upmsRoles);
    modelMap.put("upmsUserRoles", upmsUserRoles);
    return "/manage/user/role.jsp";
}
 
开发者ID:ChangyiHuang,项目名称:shuzheng,代码行数:16,代码来源:UpmsUserController.java

示例15: permission

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@ApiOperation(value = "角色权限")
@RequiresPermissions("upms:role:permission")
@RequestMapping(value = "/permission/{id}", method = RequestMethod.GET)
public String permission(@PathVariable("id") int id, ModelMap modelMap) {
    UpmsRole role = upmsRoleService.selectByPrimaryKey(id);
    modelMap.put("role", role);
    return "/manage/role/permission.jsp";
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:9,代码来源:UpmsRoleController.java


注:本文中的org.springframework.ui.ModelMap.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。