Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Advised by @JB Nizet, I removed </p> <ol> <li><code>ControllerClassNameHandlerMapping</code></li> <li><code>urlMapping</code></li> <li><code>indexController</code></li> </ol> <p>from the <code>dispatcher-servlet.xml</code> file, and simply replaced it by <code>&lt;mvc:annotation-driven /&gt;</code>. </p> <p>What's more, <code>&lt;context:component-scan base-package="com.mycompany.myapp.controllers"&gt;&lt;/context:component-scan&gt;</code> was add to the <code>dispatcher-servlet.xml</code> file.</p> <p>Also, you need to specify <code>xsi:schemaLocation</code>, so add </p> <p>"<code>http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd</code>"</p> <p>to the <code>xsi:schemaLocation</code> attribute. </p> <p>And after all of these, I edited <code>index.jsp</code> to : (make student as student.htm) </p> <pre><code> &lt;form method="GET" action="student.htm"&gt; &lt;input type="submit" value="submit"&gt; &lt;/form&gt; </code></pre> <p>And simply wrote those in my StudentController.java:</p> <pre><code>@RequestMapping(value="/index.htm", method=RequestMethod.GET) public String index(){ return "index"; } @RequestMapping(value = "/student.htm",method = RequestMethod.GET) public ModelAndView student(){ return new ModelAndView("student", "command", new Student()); } </code></pre> <p>After those, the problem was fixed.<br> Maybe I should consider useing Eclipse instead of NetBean to build Spring.</p>
 

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