If you have an external JS or CSS file and want to include that in your JSP, here is a simple way to do that.
<script language="javascript" src='<%=renderRequest.getContextPath() + "/js/sample.js" %>'>
</script>
<link rel="stylesheet" type="text/css" href="<%=renderRequest.getContextPath() + "/css/sample.css" %>">
The CSS file is located at /webapps/css/
The JS file is located at /webapps/js/
And JSP is located at /webapps/WEB-INF/jsp
Hope this helps.
thanks a lot, this is what i was looking for, including that renderRequest.getContextPath()
ReplyDeleteThans again