I am new to Spring MVC3 and I understand basic concepts. I am able to do simple things like creating controllers and services and ideas. However, I have not created a place in the more advanced area, so, if this question seems silly (or impossible), then I am sorry.
I am thinking that there is no way to block and modify the view and / or response before the customer is sent? I imagine the data binding to create the elements coming out of the Spring Client. What I would like to do, I am observing comments on the elements of the domain class and can modify the view according to those annotations. This will include the new code (HTML or Javascript) injection in response.
UPDATE
As I thought a little more about this, I realized that the final dedication is done by JSP, so I think the question is Is this a way to keep the model in the middle before leaving this page, and to understand the comments on the bean that the data is being compelled.
Is there any way to do this?
The class you are looking for is org.springframework.web .servlet. HandlerInterceptor You can apply the posthandle method to that interface and, as the signature means, both the request and the response as well as the map of the model object that your administrator has created (and the controller, This is what is the object handler parameter.)
You can 'Turn On' to Your Dispatcher Servlet Add them to the handler mapping and turn them on.
& lt; Bean class = "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" & gt; & Lt; Property Name = "Interceptor" & gt; & Lt; List & gt; & Lt; Bean class = "a.package.MyHandlerInterceptor" /> & Lt; / List & gt; & Lt; / Property & gt; & Lt; / Bean & gt; Incidentally, the bond is actually carried out inside the handler adapter which finds and invents the controller's methods, it is not an interceptor. EDIT: To answer your edit, this is where you have a chance to capture and work with the model object, after the controller, but before the JSP rendering, Can add myCustomScript to ModelMap and do something in the form of your JSP in $ {myCustomScript} in and gt . Supporting the object outside of ModelMap and checking it etc.
Comments
Post a Comment