title: Spring mvc calling controller from jsp results in wrong url
body: <p>I am new in developing with Spring MVC. 
  I am trying to call the controller from my jsp file.
  I gave the requestmapping annotation to the controller, but when I try to call from my mainview.jsp which is found on the url: (I am testing on localhost) "/AirlineDB_Spring/views/mainview.jsp" (this works fine),
  the project name disappears from the url and I get this address which gives me 404: "/passengers/" I don't know why "AirlineDB_Spring/" disappears from the link, this looks like the main problem.</p>
  
  <p>My Controller code:</p>
  
  <pre><code>@Controller
  @RequestMapping(value="/passengers")
  public class PassengerController{
  
      @SuppressWarnings("unchecked")
      @RequestMapping(method=RequestMethod.GET)
      public String list(Model model) {
          List&lt;String&gt; tl = new ArrayList&lt;String&gt;();
          tl.add("one");
          tl.add("two");
          tl.add("three");
          model.addAttribute("testlist", tl);
          return "mainview";
      }
  </code></pre>
  
  <p>My jsp file's code is:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"&gt;
  &lt;title&gt;Airline Database&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
       &lt;h2&gt;Passengers&lt;/h2&gt;
       &lt;a href="/passengers/"&gt;click&lt;/a&gt;
       &lt;c:forEach items="${model.testlist}" var="test" varStatus="loopStatus"&gt;
           ${loopStatus.count}  ${test}&lt;br/&gt;
       &lt;/c:forEach&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My web.xml file:</p>
  
  <pre><code>  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;classpath*:WEB-INF/spring/*.xml&lt;/param-value&gt;
    &lt;/context-param&gt;
  
    &lt;listener&gt;
       &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;
  
    &lt;servlet&gt;
       &lt;servlet-name&gt;airlinedb&lt;/servlet-name&gt;
       &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
       &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;airlinedb&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>THe servlet-context.xml contains this:</p>
  
  <pre><code> &lt;context:annotation-config/&gt;
   &lt;context:component-scan base-package="airlinedb.controller"/&gt;
   &lt;mvc:annotation-driven/&gt;
  </code></pre>
  
  <p>I searched through the internet, found a lot of problems in connection with controller mapping, but none of those worked for me, I also tried calling the controller with href="/passenger" but got the same 404.
  I don't know what configs I am missing, I can see that I get the wrong url, but I have no idea what might be wrong.
  Can anyone help me?</p>