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

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.

主站蜘蛛池模板: 沙河市| 固原市| 枞阳县| 安丘市| 应城市| 板桥市| 南岸区| 屯门区| 疏勒县| 工布江达县| 望谟县| 白朗县| 娱乐| 临海市| 钟山县| 通榆县| 山阳县| 彭阳县| 江西省| 遂昌县| 财经| 镇雄县| 衡山县| 电白县| 贵德县| 商河县| 肥城市| 班玛县| 宁蒗| 尤溪县| 博湖县| 油尖旺区| 马龙县| 芦山县| 阜宁县| 凤翔县| 岗巴县| 凌源市| 绥滨县| 福鼎市| 孝昌县|