10.3.6 encodeURL

The encodeURL method is used in both APIs. However, in JSR 168, the encodeURL must be passed a root relative path. You should use the RenderRequest.getContextPath() method before the path of the included file. In Example 10-17, we will include the myimage.gif image under the images directory.

Example 10-17 encodeURL

<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/myimage.gif") %>


Redbooks
ibm.com/redbooks