0

後にhttp 400の問題(構文が悪い)が発生します

<input type="hidden" id="_orderDate_id" name="orderDate" value="${orderDate}"/>

しかし、この入力要素を削除した後はすべて問題ありません

しかし、本当にそのような日付フィールドをフォーマットする必要があるのでしょうか?

コントローラーで使用される日付形式のバインダーを次に示します。

@InitBinder
public void registerDateBinder(WebDataBinder binder) {
    DateFormat printFormat = new SimpleDateFormat(DateTimeFormat.patternForStyle("S-", LocaleContextHolder.getLocale())); // format for data on the UI
    printFormat.setLenient(false);
    DateFormat sortFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); // format for data get back from UI
    sortFormat.setLenient(false);
    binder.registerCustomEditor(Date.class, new ExpandableCustomDateEditor(printFormat, Arrays.asList(printFormat, sortFormat), true));
}
4

1 に答える 1

0

質問のコメントに追加するために、最初の JSP のソースをチェックして、非表示の値が実際に orderDate に格納された日付としてレンダリングされているかどうか、または文字通り ${orderDate} が表示されているかどうかを確認してください。ビュー ソースには結果が表示されるはずなので、すべてが実際にレンダリングされ、適切に機能している場合は日付が表示されます。

于 2013-09-17T19:12:38.490 に答える