开发者

Use spring form tags or not?

I am working on a new web project based on Spr开发者_开发百科ing MVC 3. Now trying to decide to use spring form tags or not. Personally I don't like to use any tags other than HTML and JSP. It takes time to learn them and it is so hard to understand how they are rendered and the error msgs when they occur. So are there any outstanding advantages to use them? Thank you!


The Spring MVC form tags are very basic indeed, but they're better than nothing. If you're trying to render HTML forms, with submissions, error messages, and resubmissions, they take a lot of the annoyance away (especially for <select> fields, which are a huge pain to handle otherwise).

For anything more complex, they're pretty useless, but for forms, I see no reason to not use them.


Another benefit of spring tags is that when you make a mistake and you write the name of a property which doesn't exist in the object to populate it gives you an error, so you can easily find-out that you have to correct the name of the property in the path attribute of the tag.


The benefit of using the spring form tags is that you will get consistent data binding and error handling across your entire website. I would recommend wrapping the spring form tags in your own tags - this will allow you to easily swap in your own implementations at a later date if you find the spring tags lacking functionality you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜