Currently every page in my current location has a web-url as follows.
/test/test
In my controller the rest mapping works just fine and finds a page test.jsp.
/test/test.jsp does not work.
Now I need to do redirects from old urls to new urls. These have .jsp in every one of their urls. When I set up the url I get a 404 error. When I remove the .jsp heading it at least hits my request mapping.
I need to find a way where the controller can recognize jsp’s with or without the jsp extension. I am trying to then redirct.
Here is part of my application context.
<beans:bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<beans:property name="viewClass"
value="org.springframework.web.servlet.view.tiles2.TilesView" />
</beans:bean>
Here is the setting in my web.xml.
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
I’d write a servlet
Filterthat checks if the request path ends with “.jsp”, and if so does a redirect to the same path without “.jsp”.