1.输入框
class="required" 必选属性设置 红色*提示用户为必选
<div class="control-group"> <label class="control-label">名称:</label> <div class="controls"> <form:input path="name" htmlEscape="false" maxlength="50" class="required" /> <span class="help-inline"><font color="red">*</font> </span> </div> </div>
2.选择框(死框)
显示的是人力来源、工作场所 存入的是HS、WP
<div class="control-group"> <label class="control-label">类型:</label> <div class="controls"> <form:select id="type" path="type" class="input-medium select"> <form:option value="">----select----</form:option> <form:option value="HS">人力来源</form:option> <form:option value="WP">工作场所</form:option> </form:select> <span class="help-inline"><font color="red">*</font> </span> </div> </div>
3.选择框(活框)
items 取出后台存入的list集合 选择框中显示的是itemLabel的值 存入的是itemValue(这是很有用的)
<div class="control-group"> <label class="control-label">项目名称:</label> <div class="controls"> <form:select path="projectBasicId" htmlEscape="false" style="220px" class="required"> <form:option value="">----select----</form:option> <form:options items="${projectList}" itemLabel="projectName" itemValue="projectBasicId" /> </form:select> <span class="help-inline"><font color="red">*</font> </span> </div> </div>
后台的存在model中
List<DpmProjectInfo> projectList = dpmResourceInfoService.findProjectList(); model.addAttribute("projectList", projectList);