Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring 3.0 MVC mvc:view-controller tag
    primarykey
    data
    text
    <p>Here's a snippet of my mvc-config.xml:</p> <pre><code>&lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/WEB-INF/views/"/&gt; &lt;property name="suffix" value=".jsp"/&gt; &lt;/bean&gt; &lt;mvc:view-controller path="/index" view-name="welcome"/&gt; &lt;mvc:view-controller path="/static/login" view-name="/static/login"/&gt; &lt;mvc:view-controller path="/login" view-name="/static/login"/&gt; </code></pre> <p>I have the welcome.jsp on /WEB-INF/view/ directory and login.jsp on /WEB-INF/view/static/. </p> <p>This works for '/index' and '/login' paths. But I'm getting 404 response for '/static/login' when invoked from the browser. I'm expecting that '/static/login/' and '/login' should behave the same. </p> <p>What could be wrong here?</p> <p>Would appreciate any help.</p> <p>Thanks!</p> <p>Here's the web.xml:</p> <pre><code>&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;classpath*:META-INF/spring/applicationContext*.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;!-- Enables clean URLs with JSP views e.g. /welcome instead of /app/welcome --&gt; &lt;filter&gt; &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; &lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;!-- Handles all requests into the application --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; /WEB-INF/spring/*.xml &lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;!-- Maps all /app requests to the DispatcherServlet for handling --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/app/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p>and here is the urlrewrite.xml:</p> <pre><code>&lt;urlrewrite default-match-type="wildcard"&gt; &lt;rule&gt; &lt;from&gt;/&lt;/from&gt; &lt;to&gt;/app/welcome&lt;/to&gt; &lt;/rule&gt; &lt;rule&gt; &lt;from&gt;/static/**&lt;/from&gt; &lt;to last="true"&gt;/static/$1&lt;/to&gt; &lt;/rule&gt; &lt;rule&gt; &lt;from&gt;/**&lt;/from&gt; &lt;to last="true"&gt;/app/$1&lt;/to&gt; &lt;/rule&gt; &lt;outbound-rule&gt; &lt;from&gt;/app/**&lt;/from&gt; &lt;to&gt;/$1&lt;/to&gt; &lt;/outbound-rule&gt; &lt;/urlrewrite&gt; </code></pre> <p>Environment: I'm using SpringSource tc Server Dev Edition v2.0<br> Spring version: 3.0.3.RELEASE </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.
 

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