Searching since yesterday, but I only get adance method. I use spring with tomcat and I want to handle the get paramter. But for that what I need first is to succefully map the url. (an example, /store.htm?id=X) At the begining I match every .htm url with
<servlet-mapping>
<servlet-name>myapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
In my web.xml
I handle them with for example
<bean name="/main.htm" class="package.to.my.Controller">
<property name="aManager" ref="aManager"/>
</bean>
and it works, but when I want to use some get parameter with an url like /store.htm?id=X the mapping didn't work anymore.
I tryed several pattern like
<servlet-mapping>
<servlet-name>myapp</servlet-name>
<url-pattern>*.htm?id=*</url-pattern>
</servlet-mapping>
or
<url-pattern>*.htm*
nothing seems to work.. How could I handle that ?
(I based myself on the tutorial of spring 2.5 on the official website).
Thanks for your help
The mapping doesn't care about the query string. It only cares about the path of the URL. A request to /main.htm?id=foo
will be mapped to myapp
since *.htm
is mapped to myapp
.