input 就是直接在value身上设置 使用jsp的时候
前端的使用:
<form id="postForm" action="${pageContext.request.contextPath}/uploadSpotImg" method="Post" enctype="multipart/form-data">
<table>
<tr>
标题
</tr>
<tr>
<input type="text" name="sTitle" value="${spot.sTitle} "/ >
</tr>
<tr>
简介
</tr>
<tr>
<input type="text" name="sInfo" value="${spot.sInfo} " / >
</tr>
<tr>
地区
</tr>
<tr>
省<input name="rProvince" type="text" value=" ${spot.regionInfo.rProvince}" />
市<input name="rCity" type="text" value="${spot.regionInfo.rCity}" />
区<input name="rArea" type="text" value="${spot.regionInfo.rArea}" />
详细<input name="rInfo" type="text" value="${spot.regionInfo.rInfo}" />
</tr>
<tr>
图片
</tr>
<tr>
<input name="img1" type="file" value="${spot.sImg}" />
</tr>
<tr>
<input name="img2" type="file" value="" />
</tr>
<tr>
<input name="img3" type="file" value="" />
</tr>
<tr>
<input id="upload" type="submit" value="提交" />
</tr>
</table>
</form>
后台的关联:
@Autowired
SpotService spotService;
@Autowired
RegionInfoService regionInfoService;
// 景点模块
@RequestMapping("/spotModule")
public String spotModule(HttpServletRequest request, HttpServletResponse resp) {
request.setAttribute("spots", spotService.all());
return "spotModule";
}
给value设置就是直接给赋值
浙公网安备 33010602011771号