I have a strange problem here, but I'm not sure if this is a mistake. The project works under the Spring Framework.
View:
<form method="GET" action="someUrl.htm" enctype="application/x-www-form-urlencoded" > <label>Label</label> <input name="val1" value="${val1}" /> ... </form>
The controller switches to someUrl.htm using SimpleUrlHandlerMapping
<bean id="parameterMethodNameResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="methodParamNames"> ... </bean> <bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="urlDecode" value="false" /> <property name="mappings"> <props> <prop key="**/someUrl.htm">someController</prop> </props> </property> </bean>
I want to pass % as val1 . But when I do this, the following code fragment returns null:
request.getParameter("val1");
catalina.out shows:
WARNING: Parameters: character decoding failed. The parameter "val1" with the value "%" was ignored.
I will find out that Spring decodes the query string, and request.getQueryString() returns val1=% , but not val1=%25 .
How to prevent urldecoding here?
This is mistake? Note that urlDecode set to false .
Any ideas to solve this problem, because I really need to use characters like %&= .
java spring-mvc forms servlets urldecode
Sqeezer
source share