我有以下jsp:
<form:select path="terminalStatus">
<form:options items="${allStatuses}"/>
</form:select>
它呈现如下:
<select id="terminalStatus" name="terminalStatus">
<option value="ACTIVE" selected="selected">ACTIVE</option>
<option value="INACTIVE">INACTIVE</option>
</select>
我希望它呈现出一点不同。像这样:
<select id="terminalStatus" name="terminalStatus">
<option value="ACTIVE" selected="selected">label_1</option>
<option value="INACTIVE">label_2</option>
</select>
实际上allstatuses
是一组枚举值TerminalStatus
:
public enum TerminalStatus {
ACTIVE("label_1"), INACTIVE("label_2");
String label;
public String getLabel() {
return label;
}
private TerminalStatus(String label) {
this.label = label;
}
}
spring form 是否允许自定义我的 jsp 以获得所需的结果?