Dave
Dave

Reputation: 557

Resource not found under webapp folder

I'm using eclipse Juno with Spring and Maven, I created a pkeditor folder under webapp and then copied files into it. My jsp is not finding the pkeditor files (404ing). I have the following at the top of my jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>


<%@ page session="false" %>
<html>
<head>
<script type="text/javascript" src="/resources/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/resources/ckeditor/adapters/jquery.js">   script>
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/ckeditor/adapters/jquery.js"></script>
<title>Home</title>


</head>
<body>

Note: in my servlet-context.xml I have tried both

and

<resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>

and still not found.

There must be a simple answer to this.

Upvotes: 0

Views: 590

Answers (2)

Rigg802
Rigg802

Reputation: 2674

you could use spring:url

<spring:url value="/resources/ckeditor/ckeditor.js" var="script_url" />
<script src="${script_url}" type="text/javascript"><!-- required for FF3 and Opera --></script>

Upvotes: 0

Manuel Quinones
Manuel Quinones

Reputation: 4246

For your source path use the following for example.

<script type="text/javascript" src="${pageContext.servletContext.contextPath}/resources/ckeditor/ckeditor.js"></script>

Upvotes: 1

Related Questions