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

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

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

2019-11-14 10:47:18
字體:
供稿:網(wǎng)友
什么是數(shù)據(jù)回顯表單提交后,如果出現(xiàn)錯(cuò)誤,將剛才提交的數(shù)據(jù)回顯到剛才提交的頁面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回顯到頁面在request中的key
public String editUserSumit(Model model, Integer id,@ModelAttribute("user") @Validated(value=(ValidationGroup1.class)) UserCustom userCustom, BindingResult bindingResult) throws Exception {}@ModelAttribute還可以將方法的返回值傳到頁面jsp頁面:
<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ā)表
主站蜘蛛池模板: 基隆市| 鄯善县| 宜川县| 五大连池市| 文化| 隆回县| 齐齐哈尔市| 陆良县| 兴国县| 乌恰县| 潮州市| 上饶市| 浦县| 米脂县| 元朗区| 突泉县| 广宗县| 南投县| 南平市| 新平| 凤翔县| 东山县| 从江县| 苏州市| 洪雅县| 大石桥市| 临泉县| 阳西县| 平塘县| 蓬溪县| 东安县| 都江堰市| 克拉玛依市| 栾川县| 当阳市| 明光市| 清水县| 嫩江县| 宜君县| 定日县| 师宗县|