here is my web.xml
<servlet>
<servlet-name>Learn</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Learn</servlet-name>
<url-pattern>/learn/*</url-pattern>
</servlet-mapping>
if i change this code
<url-pattern>/learn/*</url-pattern>
to
<url-pattern>/learn/abc/</url-pattern>
i can hit my controller code which is given as
@Controller
@RequestMapping(value = "/learn")
public class ControllerClass
{
@RequestMapping(value = "/", method = RequestMethod.GET)
public String callRequest(ModelMap model)
{
return "index";
}
@RequestMapping(value = "/abc/", method = RequestMethod.GET)
public String personController(ModelMap model)
{
return "welcome";
}
}
but i also want to hit the first method or i will add more method, which i can not achieve by
/learn/abc/
in url mapping.
so please help me out with this
pom.xml
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- spring-context which provides core functionality -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<!-- The spring-aop module provides an AOP Alliance-compliant aspect-oriented
programming implementation allowing you to define -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<!-- The spring-webmvc module (also known as the Web-Servlet module) contains
Spring’s model-view-controller (MVC) and REST Web Services implementation
for web applications -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<!-- The spring-web module provides basic web-oriented integration features
such as multipart file upload functionality and the initialization of the
IoC container using Servlet listeners and a web-oriented application context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
</dependencies>
please let me know if i missed any dependency
<url-pattern>, i.e. leave it as<url-pattern>/learn/*</url-pattern>? Do requests for both/learn/and/learn/abc/work then?callRequestmethod when you change the url to/learn/*am I right?