Reputation: 16629
My file structure in eclipse is
src/
com.test/
Servlet1.java
I am trying to refer to it in JSP using
<jsp:include page="com.test/Servlet1"></jsp:include>
It gives me the File not found
error.
Here com.test is the package name and Servlet1.java
is the servlet file I want to use.
Upvotes: 0
Views: 3336
Reputation: 3605
The usage of <jsp:include>
is
<jsp:include page="{relativeURL | <%= expression%>}" flush="true" />
So page
attribute should be a relative URL rather than a Servlet file path.
For example, if you configure your Servlet1
as:
<servlet>
<servlet-name>Servlet1</servlet-name>
<servlet-class>com.test.Servlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
Then your jsp:include
tag should be:
<jsp:include page="/test"></jsp:include>
Upvotes: 1
Reputation: 955
I believe com.test makes a new folder named "test" inside a folder named "com" which means the path should be com/test/Servlet1 instead of your com.test, not completely sure tho
Upvotes: 0