<select name="darithy.employee.employeeId" value="${darithy.employee.employeeName }"> <c:forEach items="${emplist}" var="employee"> <c:if test="${employee==darithy.employee}"> <option value="${employee.employeeId}" selected="selected">${employee.employeeName }</option> </c:if> <c:if test="${employee!=darithy.employee}"> <option value="${employee.employeeId }">${employee.employeeName }</option> </c:if> </c:forEach> </select>
若用s标签则很简单:
<s:select list="emplist" listKey="employeeId" listValue="employeeName" name="darithy.employee.employeeId"></s:select>
注:employee与darithy是一对多的关系