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


Java ModelMap.get方法代码示例

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


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

示例1: resolveArgument

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@Override
public Object resolveArgument(
		MethodParameter parameter, ModelAndViewContainer mavContainer,
		NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
		throws Exception {

	ModelMap model = mavContainer.getModel();
	if (model.size() > 0) {
		int lastIndex = model.size()-1;
		String lastKey = new ArrayList<String>(model.keySet()).get(lastIndex);
		if (lastKey.startsWith(BindingResult.MODEL_KEY_PREFIX)) {
			return model.get(lastKey);
		}
	}

	throw new IllegalStateException(
			"An Errors/BindingResult argument is expected to be declared immediately after the model attribute, " +
			"the @RequestBody or the @RequestPart arguments to which they apply: " + parameter.getMethod());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:ErrorsMethodArgumentResolver.java

示例2: updateBindingResult

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
/**
 * Add {@link BindingResult} attributes to the model for attributes that require it.
 */
private void updateBindingResult(NativeWebRequest request, ModelMap model) throws Exception {
	List<String> keyNames = new ArrayList<String>(model.keySet());
	for (String name : keyNames) {
		Object value = model.get(name);

		if (isBindingCandidate(name, value)) {
			String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + name;

			if (!model.containsAttribute(bindingResultKey)) {
				WebDataBinder dataBinder = binderFactory.createBinder(request, value, name);
				model.put(bindingResultKey, dataBinder.getBindingResult());
			}
		}
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:ModelFactory.java

示例3: afficher

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping(value="/afficherModificationToDoList", method = RequestMethod.GET)
public String afficher(final ModelMap pModel) {
    if (pModel.get("modification") == null) {
        final List<ToDoList> lToDoLists = service.RechercherToDoList();
        final ModificationForm lModificationForm = new ModificationForm();
        final List<ModificationToDoList> lListe = new LinkedList<ModificationToDoList>();
        for (final ToDoList lToDoList : lToDoLists) {
            final ModificationToDoList lModificationToDoList = new ModificationToDoList();
            lModificationToDoList.setId(lToDoList.getId());
            lModificationToDoList.setLibelle(lToDoList.getLibelle());
            lListe.add(lModificationToDoList);
        }
        lModificationForm.setToDoList(lListe);
        pModel.addAttribute("modification", lModificationForm);
    }
    return "modification";
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:18,代码来源:ModifierToDoListController.java

示例4: afficher

import org.springframework.ui.ModelMap; //导入方法依赖的package包/类
@RequestMapping(value="/afficherCreationToDoList", method = RequestMethod.GET)
public String afficher(final ModelMap pModel) {
	//Création d'un objet ToDoList puis Lecture de la table
	final List<ToDoList> lToDoLists = service.RechercherToDoList();
       pModel.addAttribute("creertodolist", lToDoLists);
       
       if (pModel.get("creation") == null) {
           pModel.addAttribute("creation", new CreationForm());
       }
       return "creation";
   }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:12,代码来源:CreerToDoListController.java


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