开发者

how spring mvc tag works?

I am trying to write some kind of raw html to mimic what spring mvc tag produces after page rendering(and I do make them look exactly the same if you open them with a html element inspector). as I want to create dynamic input form using javascript. but it didn't work. it seems I had to use only what it offers: e.g. <form:input path="firstName" />. to get the data binding working.

I thought the tag lib only help you to produce a html block that spring knows how to handle them in backend (action). from a web http perspective. what else it can send beyond a bunch of form data, and they should send the same thing. so I am really curious to learn what magic thing the tag lib dose beyond producing a html block.

the other thing I would like to know is where the model object is being hold when the form is being submit to a matched action. you know, you can get the model attribute by using @modelAttribute as the input parameter. is it in the original request object? or in the ActionRequest to which the dispatcherServlet build and p开发者_JAVA技巧ut it. or even somewhere else? thanks in advance.


I got it figured out. the raw html just works as spring tag does. as long as you are in the form tag block. you are okay to use raw html such as <input type="text" id="abc" name="abc"/> just make sure name reflect your bean attribute path. id is not mandatory and is just helping you to identify the very element. I guess I missed something when I work with the raw html by the time I ask the question. hope this helps for guys working with raw html approach, especially in case of dynamic input creation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜