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: , , ,

Nov 15

Java includes an undocumented class, sun.misc.BASE64Encoder, for handling Base64 encoding. The following gives an example of its usage.


byte[] bytes = getBytesFromSomewhere();

// Create encoder

BASE64Encoder encoder = new BASE64Encoder();

// Create encoded string from supplied byte array

String encoded = encoder.encode(bytes);

There are lots of other encoders available if you don’t want to use that one.

written by objects \\ tags: ,