Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Using java configuration: </p> <pre><code>@Configuration @EnableWebMvc public class WebConfig {} </code></pre> <p>or using XML configuration</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt; &lt;mvc:annotation-driven /&gt; </code></pre> <p></p> <p>From <a href="http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping" rel="nofollow">Spring's reference documentation</a>:</p> <blockquote> <p>The above registers a <strong>RequestMappingHandlerMapping</strong>, a RequestMappingHandlerAdapter, and an ExceptionHandlerExceptionResolver (among others) in support of processing requests with annotated controller methods using annotations such as @RequestMapping , @ExceptionHandler, and others.</p> </blockquote> <p>In <code>RequestMappingHandlerMapping</code> there is useful boolean flag - decription from Javadoc:</p> <pre><code>/** * Whether to match to URLs irrespective of the presence of a trailing slash. * If enabled a method mapped to "/users" also matches to "/users/". * &lt;p&gt;The default value is {@code true}. */ public void setUseTrailingSlashMatch(boolean useTrailingSlashMatch) { this.useTrailingSlashMatch = useTrailingSlashMatch; } </code></pre> <p>Since this is enabled by default just make sure that your configuration uses <code>RequestMappingHandlerMapping</code>.</p> <p>If this doesn't help you, check that spring's default servlet is configured: <code>&lt;mvc:default-servlet-handler/&gt;</code> and try add to <code>web.xml</code></p> <pre><code>&lt;!-- Disables Servlet Container welcome file handling. Needed for compatibility with Servlet 3.0 and Tomcat 7.0 --&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; </code></pre>
 

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