Thursday, February 09, 2006

How to load resources in a servlet.


Resources like images and similar contents can be loaded by using
Fully qualify references to other resources from the context path.

img src="${pageContext.request.contextPath}/images/myImage.png}" alt="..." />

or for containers that don't support JSP 2.0:

img src="<%=request.getContextPath() + "/images/myImage.png"%> alt="..." />

0 Comments:

Post a Comment

<< Home