官术网_书友最值得收藏!

How it works...

Spring automatically configures a large number of default editors; but for custom types, we have to explicitly instantiate new editors for every web request. This is done in the controller in a method that is annotated with @InitBinder. This annotation is scanned and all the detected methods should have a signature of accepting WebDataBinder as an argument. Among other things, WebDataBinder provides us with an ability to register as many custom editors as we require for the controller methods to be bound properly.

It is very important to know that PropertyEditor is not thread-safe! For this reason, we have to create a new instance of our custom editors for every web request and register them with WebDataBinder.

In case a new PropertyEditor is needed, it is best to create one by extending PropertyEditorSupport and overriding the desired methods with custom implementation.

主站蜘蛛池模板: 炉霍县| 商丘市| 南汇区| 休宁县| 岗巴县| 武穴市| 靖边县| 西城区| 来安县| 梧州市| 邳州市| 泸溪县| 边坝县| 苗栗县| 肇源县| 沾化县| 华宁县| 白河县| 南开区| 枣强县| 德清县| 无棣县| 团风县| 临泉县| 于都县| 泰安市| 嘉荫县| 大同县| 利辛县| 军事| 景泰县| 浮山县| 水富县| 大埔县| 巢湖市| 高碑店市| 英超| 灵山县| 黑龙江省| 奉贤区| 永平县|