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