In my application which is using JSTL tag library version 1.1 when using url tag in JSP as shown below.
<c:url var="Url" value="/testUrl">
<c:param name="action" value="login"/>
<c:param name="name" value="test"/>
</c:url>
In old version of Internet Explorer this gets converted to: http://applicationurl.com/testUrl?action=login&name=test
While in Edge browser this gets converted as:
http://applicationurl.com/testUrl?action=login&name=test
So the & gets converted to "&
". Now for the controller when it tries to get the parameter name using below code.
private void outputRequestParams(HttpServletRequest request) {
Enumeration requestParameter = request.getParameterNames();
while (requestParamNames.hasMoreElements()) {
String paramName = (String)requestParameter.nextElement();
System.out.println("Parameter Name: " + paramName);
}
The above code returns below as parameter name.
When using old Internet Explorer: Parameter Name: name
When using Edge Browser: Parameter Name: amp;name
Due this many places in the code which is expecting parameter name as name is failing as it is getting amp;name.
We are using servlet api 5.5.23 jar.
Question:
- Why the & is getting appended only when we are forming url using c:url tag? While when we form the url directly using string it works fine.
- Is this happening due to any jar version mismatch.
- What common fix we can apply for the above issue in our application so that it starts working on Edge browser and we can avoid making changes at multiple places.
Please let me know if more information is required. Thanks in advance.