本文整理汇总了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";
}
}
示例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;
}
示例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;
}
示例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";
}
示例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";
}