I have a problem with Spring 3.0.7 Request mapping and the Spring standard theme implementation.
My controllers are implemented as follows
@ Controller
@RequestMapping(value="myUrl")
Public MyControllerClass
@RequestMapping(Method=requestMethod.GET)
Public myGetHandler (){
}
So a URL with http://myApp/myUrl is handled and all is good.
Themes are activated by a link link this
<a href="?theme=mytheme"/>
and the spring config for themes is
<bean id="themeChangeInterceptor" class="org.springframework.web.servlet.theme.ThemeChangeInterceptor">
<property name="paramName" value="theme" />
</bean>
So if I am on the myUrl page and I click this link the theme is loaded and myGetHandler also invoked.
however
if I add a parameter to my URL
/myUrl?someParm=somevalue
now my controller works as before and i can access the parameter but clicking on the themes link ( see href above ) which for this page looks like this
/myUrl?theme=myTheme
causes an exception and neither the page or the theme load. I will post the stack trace later but it suggested a problem in the controller ( and not theme interceptor ).
How can I map my controller so that themes and a parameterized URL work? Ideally I think I want to change my request mapping to only handle my parameterized url and nothing else ?
I tried changing my request mapping to
@RequestMapping(value="myUrl",params = "someParam=someValue")
While this works for the links with my parameters it fails for the theme link.
My guess is then in case when url is with params , click on
<a href="?theme=mytheme"/>casues double “?” in destination url like/myUrl?someParm=somevalue?theme=mytheme.You should use something like c:url or some javascript to build url with only one ? and & as params delimeter