JSP
<select name="requirements" style="width:150px;" id="requirements1">
<option selected="selected" value="o Special Assistance">No Special Assistance</option>
<option value="Assistance climbing steps">Assistance climbing steps</option>
<option value="Assistance within the plane">Assistance within the plane</option>
<option value="Blind passenger">Blind passenger</option>
<option value="Hearing impaired">Hearing impaired</option>
<option value="Wheelchair within terminal">Wheelchair within terminal</option>
</select>
<select name="requirements" style="width:150px;" id="requirements2">
<option selected="selected" value="o Special Assistance">No Special Assistance</option>
<option value="Assistance climbing steps">Assistance climbing steps</option>
<option value="Assistance within the plane">Assistance within the plane</option>
<option value="Blind passenger">Blind passenger</option>
<option value="Hearing impaired">Hearing impaired</option>
<option value="Wheelchair within terminal">Wheelchair within terminal</option>
</select><input type="text" name="specialrequest" id="specialrequest1" />
</form>
班级
public class PassengerDetailDTO {
private String[] requirements;
private String specialrequest;
}
并在控制器中
@RequestMapping(value = "/manualbooking.htm", method = RequestMethod.POST)
public String doManualBooking(HttpServletRequest httpServletRequest,
PassengerDetailDTO passengerDetailDTO, ModelMap map) {
LOGGER.info("Manual Booking Request");
LOGGER.info(passengerDetailDTO.toString());
return "manualbooking";
}
当有多个下拉框时,提交表单后要求始终为空。如何解决?