當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。