0

I am trying to import several jsp and html pages in one single jsp page in spring mvc. I have added the docbase in server.xml of apache tomcat as

<Context docBase="/Users/uname/Desktop path="statfiles" />
<Context docBase="BankFeed" path="/helloweb" reloadable="true" source="org.eclipse.jst.jee.server:BankFeed"/></Host>

but when i am import the file in my jsp page

<c:import var="testfile" url="/statfiles/test.html" />
<c:out value="${testfile}" />

I am getting this warning

WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/helloweb/statfiles/test.html] in DispatcherServlet with name 'appServlet'

How can i resolve this issue and how to get the jsp and html pages outside the webapp project folder.

This is the directory Structure enter image description here

Sumit Kumar
  • 402
  • 1
  • 6
  • 26

1 Answers1

0

You can follow a spring-mvc way, and add a mapping for static resources, with location prefixed with file:

so

<mvc:resources mapping="/statfiles/**" location="file:/Users/uname/Desktop/" />

in SpringMVC the prefix inside the location instructs the lookup strategy, and there are four types

classpath: - resources loaded from the classpath.
file: - resources loaded as a URL, from the filesystem.
http: - resources loaded as a URL.
(none) - resources relative to the ROOT

You can read more about configuring static resources in Spring MVC here http://docs.spring.io/spring/docs/current/spring-framework-reference/html/resources.html

Master Slave
  • 27,771
  • 4
  • 57
  • 55