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


Java Model.addAllAttributes方法代码示例

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


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

示例1: handleGetImage

import org.springframework.ui.Model; //导入方法依赖的package包/类
@GetMapping("/folder/{keyFolder}/image/{keyImg}")
public String handleGetImage(Model model,
                             @PathVariable String keyImg,
                             @PathVariable String keyFolder) throws IOException {
    Image image = imageService.get(keyImg);

    if (image == null) {
        throw new ResourceNotFoundException();
    } else {
        List<Folder> folders = folderService.get(keyFolder);

        model.addAllAttributes(getAttributesOfFolder(image, folders));
        model.addAllAttributes(getAttributesOfImage(image));
        model.addAllAttributes(getAttributesOfLessInstances(keyImg, false));

        return "index";
    }
}
 
开发者ID:MrChebik,项目名称:OSPicture,代码行数:19,代码来源:LinkController.java

示例2: updatePost

import org.springframework.ui.Model; //导入方法依赖的package包/类
@RequestMapping(value = "/update/{postId}", method = GET)
public String updatePost(@PathVariable("postId") Long postId,
                         Model model, HttpServletRequest request) throws PostNotFoundException {
    Post post = postService.getPostById(postId);
    String postType = StringUtils.capitalize(post.getPostType().name().toLowerCase());
    String pageTitle = webUI.getMessage(MESSAGE_ADMIN_UPDATE_POSTLINK_TITLE, postType);
    String pageHeading = webUI.getMessage(MESSAGE_ADMIN_UPDATE_POSTLINK_HEADING, postType);

    PostDTO postDTO = getUpdatedPostDTO(post);
    if (post.getPostType() == PostType.LINK) {
        postDTO.setHasImages(post.getPostImage() != null);
        postDTO.setPostImage(post.getPostImage());
        if (postDTO.getHasImages()) {
            model.addAttribute("hasLinkImage", true);
        }
    }
    model.addAttribute("postName", post.getPostName());
    model.addAttribute("postDTO", postDTO);
    model.addAttribute("pageTitle", pageTitle);
    model.addAttribute("pageHeading", pageHeading);
    model.addAttribute("categories", postService.getAdminSelectionCategories());

    model.addAllAttributes(getPostLinkAttributes(request, post.getPostType()));

    return ADMIN_POSTLINK_UPDATE_VIEW;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:27,代码来源:AdminPostsController.java

示例3: game

import org.springframework.ui.Model; //导入方法依赖的package包/类
@RequestMapping("/{identify}")
public String game(@PathVariable("identify") String identify, Model model) {
    Optional<GameInfo> info = gameService.findInfo(identify);
    if (!info.isPresent()) {
        return "redirect:/games";
    }
    model.addAttribute("identify", identify);
    model.addAllAttributes(info.get().getAttrs());
    return "games/" + identify;
}
 
开发者ID:csdbianhua,项目名称:telemarket-skittle-alley,代码行数:11,代码来源:GameController.java

示例4: index

import org.springframework.ui.Model; //导入方法依赖的package包/类
@RequestMapping("/")
public String index(Model model) {

	Map<String, Object> dashboardMap = xxlJobService.dashboardInfo();
	model.addAllAttributes(dashboardMap);

	return "index";
}
 
开发者ID:mmwhd,项目名称:stage-job,代码行数:9,代码来源:IndexController.java

示例5: handleAnotherException

import org.springframework.ui.Model; //导入方法依赖的package包/类
@ExceptionHandler(AnotherException.class)
String handleAnotherException(HttpServletRequest request, HttpServletResponse response, Model model)
    throws IOException {
  // 需要设置Status Code,否则响应结果会是200
  response.setStatus(601);
  model.addAllAttributes(errorAttributes.getErrorAttributes(new ServletRequestAttributes(request), true));
  return "error/6xx";
}
 
开发者ID:chanjarster,项目名称:spring-mvc-error-handling-example,代码行数:9,代码来源:LooController.java


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