0

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&amp;name=test

So the & gets converted to "&amp;". 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:

  1. 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.
  2. Is this happening due to any jar version mismatch.
  3. 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.

1 Answers1

0

Looks like the only solution right now is to replace the & with & post the URL gets created. This change is working for me as I have made it in a common method that gets called from all the location. If anyone has any better solution kindly suggest.