Sep 18

When using JTST to access a request parameter we typically use something like this:

${param.xyz}

If the parameter name contains a . then this becomes

${param.xyz.abc}

Problem is that JSTL interprets this as being the abc property of the xyz bean which is not what we want.

In this case we instead need to use the more long winded JSTL syntax for specifying the property name of interest:

${param['xyz.abc']}

This now correctly returns the value of the request paramater with name ‘xyz.abc’.

written by objects \\ tags: , , , ,

Dec 12

URL parameters require the parameter values (and names) to be appropriately encoded. You can use the URLEncoder class to do this yourself, or the and tags can be used to handle it for you.

<c:url value="mypage.jsp" var="myUrl">
  <c:param name="nameParam"   value="${name}" />
  <c:param name="ageParam"    value="${age}" />
  <c:param name="genderParam" value="${gender}" />
</c:url>

Click <a href='<c:out value="${myUrl}"/>'>here</a>

written by objects \\ tags: , , ,