本文整理了Java中org.springframework.web.servlet.ModelAndView.addAllObjects()
方法的一些代码示例,展示了ModelAndView.addAllObjects()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ModelAndView.addAllObjects()
方法的具体详情如下:
包路径:org.springframework.web.servlet.ModelAndView
类名称:ModelAndView
方法名:addAllObjects
[英]Add all attributes contained in the provided Map to the model.
[中]将提供的映射中包含的所有属性添加到模型中。
代码示例来源:origin: spring-projects/spring-framework
modelAndView.addAllObjects(RequestContextUtils.getInputFlashMap(request));
if (viewName != null) {
modelAndView.setViewName(viewName);
代码示例来源:origin: org.springframework/spring-webmvc
modelAndView.addAllObjects(RequestContextUtils.getInputFlashMap(request));
if (viewName != null) {
modelAndView.setViewName(viewName);
代码示例来源:origin: com.soento/soento-web
public ModelAndView build() {
ModelAndView result = new ModelAndView(this.view);
result.addAllObjects(this.model);
return result;
}
}
代码示例来源:origin: kaif-open/kaif
private static ModelAndView layout(String layoutName) {
ModelAndView modelAndView = new ModelAndView("part-template");
modelAndView.addAllObjects(ImmutableMap.of("part", ImmutableMap.of("layout", layoutName)));
return modelAndView;
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-console-core
@RequestMapping(method=RequestMethod.GET, value="/view/{id}")
public ModelAndView viewSuggestion(@PathVariable("id") Long id, ModelMap map, HttpServletRequest request){
AuthorshipSuggestionsPackage suggestionsPackage = authorshipService.fetchSuggestionPackage(id);
ModelAndView modelAndView = new ModelAndView(VIEW_SUGGESTIONS_VIEW);
modelAndView.addObject("suggestion", suggestionsPackage);
modelAndView.addAllObjects(map);
return modelAndView;
}
代码示例来源:origin: godcheese/nimrod
/**
* 添加字典到 ModelAndView
*
* @param modelAndView ModelAndView
*/
public void addDictionaryToModelAndView(ModelAndView modelAndView) {
if (modelAndView != null) {
modelAndView.addAllObjects(keyValueMap());
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-console-core
@RequestMapping(method=RequestMethod.GET, value=LIST_SUGGESTIONS_URL)
public ModelAndView listAuthorships(@ModelAttribute("query") SuggestionsPackageQuery query, ModelMap modelMap){
ModelAndView view = new ModelAndView(LIST_SUGGESTIONS_VIEW);
view.addAllObjects(modelMap);
Page<AuthorshipSuggestionsPackage> page = authorshipService.fetchSuggestionPackages(query);
view.addObject(PAGE_ATTR_NAME, page);
view.addObject(STATUSES_ATTR_NAME, SuggestionsPackageStatus.values());
view.addObject(TYPE_ATTR_NAME, Arrays.asList(AuthorshipSuggestionsPackage.USER_SUGGESTION_TYPE, "PBN", "ORCID"));
return view;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
model.put("appConfig", config);
model.put("server", server);
model.put("memory", new MemoryInfo());
result.addAllObjects(model);
return result;
}
代码示例来源:origin: org.openrdf.sesame/sesame-http-server-spring
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
model.put("appConfig", config);
model.put("server", server);
model.put("memory", new MemoryInfo());
result.addAllObjects(model);
return result;
}
代码示例来源:origin: info.aduna.appbase/aduna-appbase-webapp-system-core
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
model.put("appConfig", config);
model.put("server", server);
model.put("memory", new MemoryInfo());
result.addAllObjects(model);
return result;
}
代码示例来源:origin: pl.edu.icm.synat/synat-console-core
@RequestMapping(method=RequestMethod.GET, value=LIST_AUTHORSHIPS_URL)
@Secured(ConsoleSecurityRoles.ROLE_USER_VIEW)
public ModelAndView listAuthorships(@ModelAttribute("query") AuthorshipQuery query, ModelMap modelMap){
ModelAndView view = new ModelAndView(LIST_AUTHORSHIPS_VIEW);
view.addAllObjects(modelMap);
Page<Authorship> page = authorshipService.fetchAuthorships(query);
view.addObject(PAGE_ATTR_NAME, page);
view.addObject(STATUSES_ATTR_NAME, AuthorshipStatus.values());
return view;
}
代码示例来源:origin: org.openrdf.sesame/sesame-http-webclient-spring
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
List<Resource> contexts = getContexts(request);
Collections.sort(contexts, ToStringComparator.getInstance());
model.put("contexts", contexts);
result.addAllObjects(model);
return result;
}
代码示例来源:origin: org.hsweb/hsweb-web-controller
@ExceptionHandler(Throwable.class)
ModelAndView handleExceptionView(Throwable exception, HttpServletResponse response) {
response.setStatus(500);
ModelAndView modelAndView = new ModelAndView("error/" + 500);
modelAndView.addAllObjects(ResponseMessage.error(exception.getMessage(), 500).toMap());
modelAndView.addObject("exception", exception);
modelAndView.addObject("absPath", WebUtil.getBasePath(WebUtil.getHttpServletRequest()));
return modelAndView;
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-http-webclient-spring
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
List<Namespace> namespaces = getNamespaces(request);
Collections.sort(namespaces, ToStringComparator.getInstance());
model.put("namespaces", namespaces);
result.addAllObjects(model);
return result;
}
代码示例来源:origin: info.aduna.appbase/aduna-appbase-webapp-system-core
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
model.put("appConfig", config);
model.put("server", server);
model.put("memory", new MemoryInfo());
model.put("javaProps", getJavaPropStrings());
model.put("envVars", getEnvVarStrings());
result.addAllObjects(model);
return result;
}
代码示例来源:origin: stackoverflow.com
@Test
public void shouldDoStuff()
{
request.setRequestURI("/myCompany/123");
// call the constructor with the name of your view
ModelAndView mav = new ModelAndView("viewName");
// add the objects to the model
mav.addAllObjects(controller.getSomeDatas("123", request));
assertEquals(mav.getViewName(), "viewName");
assertTrue(mav.getModel().containsKey("companyInfo"));
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ModelAndView result = new ModelAndView();
result.setViewName(view);
Map<String, Object> model = new HashMap<String, Object>();
model.put("appConfig", config);
model.put("server", server);
model.put("memory", new MemoryInfo());
model.put("javaProps", getJavaPropStrings());
model.put("envVars", getEnvVarStrings());
result.addAllObjects(model);
return result;
}
代码示例来源:origin: pl.edu.icm.synat/synat-console-core
@RequestMapping(method=RequestMethod.GET, value="/viewAuthorship/{id}")
@Secured(ConsoleSecurityRoles.ROLE_USER_VIEW)
public ModelAndView viewAuthorship(@PathVariable("id") Long id, ModelMap map, HttpServletRequest request) throws UserProfileNotFoundException{
Authorship authorship = authorshipService.fetchAuthorship(id);
ModelAndView modelAndView = new ModelAndView(VIEW_AUTHORSHIP_VIEW);
modelAndView.addObject("authorship", authorship);
modelAndView.addObject("profile", profileService.getUserProfile(authorship.getUserId()));
modelAndView.addAllObjects(map);
return modelAndView;
}
代码示例来源:origin: org.hsweb/hsweb-web-controller
@ExceptionHandler(BusinessException.class)
ModelAndView handleExceptionView(BusinessException exception, HttpServletResponse response) {
response.setStatus(exception.getStatus());
ModelAndView modelAndView = new ModelAndView("error/" + exception.getStatus());
modelAndView.addAllObjects(ResponseMessage.error(exception.getMessage(), exception.getStatus()).toMap());
modelAndView.addObject("exception", exception);
modelAndView.addObject("absPath", WebUtil.getBasePath(WebUtil.getHttpServletRequest()));
return modelAndView;
}
代码示例来源:origin: yuboon/Aooms
/**
* Thymeleaf 渲染
* @return
*/
public void renderThymeleaf(String viewName,Map<String,Object> model){
ModelAndView mv = new ModelAndView();
mv.setViewName(viewName);
if(model != null){
mv.addAllObjects(model);
}
this.doRender(RenderFactory.me().getThymeleafRender(mv),null);
};
内容来源于网络,如有侵权,请联系作者删除!