Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>AnnotationMethodHandlerAdapter.invokeHandlerMethod()</code> takes care of invoking handler methods. Here, a <code>ModelAndView</code> will be retrieved via <code>ServletHandlerMethodInvoker.getModelAndView()</code>. </p> <p>In your case, <code>getModelAndView()</code> gets provided the handler method's <code>null</code> return value. The <code>getModelAndView()</code> method checks for the return value's type, but <a href="https://stackoverflow.com/questions/2707322/what-is-null-in-java">as in Java null is never an instanceof any class</a>, that method's logic will create a new <code>ModelAndView</code>. A new <code>ModelAndView</code> has initially its view property set to <code>null</code>. </p> <p>Then later back up the call stack, in <code>DispatcherServlet.doDispatch()</code>, there is a test if the <code>ModelAndView</code> object has a <code>View</code> associated with it ( <code>mv.hasView()</code> ). Because <code>view == null</code>, <code>doDispatch()</code>'s logic calls <code>mv.setViewName(getDefaultViewName(request))</code>. It delegates to the registered <code>RequestToViewNameTranslator</code>, whose default implementation is <code>DefaultRequestToViewNameTranslator</code>. This subclass translates the request URI into a view name, in your case <code>form</code>.</p> <p>Later in <code>doDispatch()</code>, via <code>render()</code> -> <code>resolveViewName()</code>, this sample's <code>ViewResolver</code>s are provided with the view name <code>form</code>. Only one <code>ViewResolver</code>, <code>InternalResourceViewResolver</code> is used in this sample. Also, this <code>InternalResourceViewResolver</code> was configured in <code>src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml</code> to add the prefix <code>/WEB-INF/views/</code> and the suffix <code>.jsp</code> to the view name. So in total, it will create a <code>View</code> using the JSP file <code>/WEB-INF/views/form.jsp</code>. Luckily, a JSP file exists at exactly this location.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload