国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

數(shù)據(jù)回顯

2019-11-14 10:00:59
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
什么是數(shù)據(jù)回顯表單提交后,如果出現(xiàn)錯(cuò)誤,將剛才提交的數(shù)據(jù)回顯到剛才提交的頁(yè)面1.sPRingmvc默認(rèn)對(duì)pojo數(shù)據(jù)進(jìn)行回顯pojo數(shù)據(jù)傳入Controller方法后,springmvc自動(dòng)將pojo數(shù)據(jù)放到request域,key等于pojo類型(首字母小寫)2.使用@ModelAttribute指定pojo回顯到頁(yè)面在request中的key
public String editUserSumit(Model model, Integer id,@ModelAttribute("user") @Validated(value=(ValidationGroup1.class)) UserCustom userCustom, BindingResult bindingResult) throws Exception {}@ModelAttribute還可以將方法的返回值傳到頁(yè)面jsp頁(yè)面:
<select name="allName">						<c:forEach items="${names }" var="item">							<option value="${item.key }">${item.value }</option>						</c:forEach>				</select>Controller:
@ModelAttribute("names")	public Map<String, String> userNames(){		Map<String, String> map = new HashMap<>();		map.put("1", "麥兜");		map.put("2", "奧特曼");		return map;	}3.使用最簡(jiǎn)單的方法 使用 model,可以不用@ModelAttributemodel.addAttribute("user", userCustom);4.簡(jiǎn)單類型的數(shù)據(jù)回顯使用 model,不用@ModelAttributemodel.addAttribute("id", id);
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 萨迦县| 崇义县| 邻水| 晋城| 东安县| 英吉沙县| 女性| 甘肃省| 特克斯县| 唐河县| 岫岩| 溧水县| 乌兰县| 邵东县| 淅川县| 秭归县| 罗江县| 家居| 井冈山市| 中超| 普洱| 饶平县| 马山县| 永康市| 连州市| 金寨县| 天津市| 渭南市| 昆明市| 玉龙| 阿尔山市| 玉环县| 大理市| 镇平县| 兴隆县| 武穴市| 沾化县| 怀集县| 平度市| 安庆市| 枞阳县|