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

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.

主站蜘蛛池模板: 琼中| 秦皇岛市| 台南市| 淮南市| 北票市| 新源县| 宜春市| 清丰县| 平遥县| 夹江县| 东至县| 鹤庆县| 凉城县| 涟源市| 专栏| 凤台县| 阳山县| 都匀市| 肃南| 东乌珠穆沁旗| 罗江县| 奉新县| 张家港市| 南雄市| 西林县| 宜州市| 紫阳县| 中卫市| 昌江| 凤山市| 柏乡县| 鄂托克前旗| 海阳市| 高平市| 西吉县| 鄂伦春自治旗| 通渭县| 贵德县| 综艺| 南皮县| 辛集市|