Code example for ModelMap

Methods: addAttribute, get

0
 
	// 直接调用方法需要把root参数保存至model中 
	@RequestMapping(value = "/file/v_list.do") 
	public String list(HttpServletRequest request, ModelMap model) {
		CmsSite site = CmsUtils.getSite(request);
		String root = (String) model.get("root");
		if (root == null) {
			root = RequestUtils.getQueryParam(request, "root");
		} 
		String valid=RequestUtils.getQueryParam(request, "valid");
		Boolean validB=null;
		if(StringUtils.isNotBlank(valid)){
			if(valid.equals("1")){
				validB=true;
			}else{ 
				validB=false;
			} 
		} 
		log.debug("list Resource root: {}", root);
		if (StringUtils.isBlank(root)) {
			root = site.getUploadPath();
		} 
		String uploadPath = root.substring(site.getUploadPath().length());
		if (uploadPath.length() == 0) {
			uploadPath = "/";
		} 
		model.addAttribute("root", root);
		model.addAttribute("rel", uploadPath);
		model.addAttribute("valid",validB);
		model.addAttribute("list", resourceMng.queryFiles(root, validB));
		return "file/list"; 
	} 
	 
	@RequestMapping("/file/o_delfreefiles.do") 
	public String deleteUnValid(String root,