jquery timepicker プラグインを使用していますが、問題なく動作します。時間を選択してフォームを送信できます。私はSpring MVC 3.0を使用していますが、時間を表す文字列をJava carlendarとして解析しようとすると問題が発生します。
http://www.odi.ch/prog/design/datetime.phpという日付/時刻の変換について調べてみましたが、かなり複雑なようです。誰かが何らかのアドバイスを提供してくれませんか。これが私のコードです。これは春特有のものです。
@RequestMapping(value = "scheduleadd", method = RequestMethod.POST)
public String scheduleadd( @Valid Schedule schedule, BindingResult bindingResult,
@RequestParam("startdate") @org.springframework.format.annotation.DateTimeFormat(iso=ISO.DATE) java.util.Calendar startdate,
@RequestParam("enddate") @org.springframework.format.annotation.DateTimeFormat(iso=ISO.DATE) java.util.Calendar enddate,
@RequestParam("starttime") @org.springframework.format.annotation.DateTimeFormat(iso=ISO.NONE) java.util.Calendar starttime,
@RequestParam("endtime") @org.springframework.format.annotation.DateTimeFormat(iso=ISO.NONE) java.util.Calendar endtime,
@RequestParam("moduleInstanceId") Long mId, Model uiModel, HttpServletRequest httpServletRequest) { //my stuff goes here}
ご覧のとおり、「09:30」のような文字列を Java Carlendar として解析しようとしています。日付部分は必要ですか?日付部分を指定するにはどうすればよいですか?