Saturday 10 May 2014

spring web flow


spring web flow Mar 27, 2014 devender Spring 0 In spring MVC the flow is shown below - spring web flow When the user click submit any form or click on hyper link request first goes to web.xml. Code of a web.xml is like below SpringFlowProgram index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.html org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/dispatcher-servlet.xml Step 1When user submit any form or click on any hyper link or make request by any other meaning then the request first goes to web.xml Step 2Meaning of *.html in above code is that if any .html request that will come then it will be transfer to dispatcher-servlet.xml. In *.html the url-pattern *.html is can be changed to any other extension like .htm or any other .In that case when the request that will come with .htm or any other extension that is mention in between *.tag extension then it will be transfer to dispatcher-servlet.xml. Step 3 The dispatcher-servlet then ask the Handller-Mapping to finds the controller class where mapping for the request exist. Step4 Request is then transfer to the controller class where mapping for the request exist.The method for this mapping will execute. Step 5 The return type of the method associated with mapping cold be String or ModelAndView.When some date is sent along with response then the return ModelAndView is required because it allow to pass three parameter to pass in its constructor . Among the three parameter first is the response page ,second is of string type that is the name and the final is a parameter is data object that is being sent with the response.The other constructor is just similar when only the response page is return. Another return type is String and is used when only a response page is sent back without any data object. Step 6 Either string or ModelAndView is return to dispatcher-servlet. Step 7 Dispatcher-servlet will take pass the returning response InternalViewResolver.

http://javafreakers.com/spring-web-flow/

bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
Step 8 InternalViewResolver then find the exact page with the help of configuration information provided in dispatcher-servlet.InternalViewResolver add the suffix .jsp to the name that has come from controller class to dispatcher-servle and return the response back to the user .