I have two different project In first Project have all js,ftl java files and I included jsp file also in:
Webcontent/test.jsp
META-INF/resources/test.jsp
META-INF/test.jsp
When I exported this jar file in another project, I'm unable to call this jsp file.
Tried Following way:
<jsp:include page="/test.jsp"></jsp:include>
<jsp:include page="/test.jar!/resources/test.jsp"></jsp>
but it's still showing error while accessing this path in jsp.
Related
After a lot of debugging I found that every time I include jsp files like:
<jsp:include page="header.jsp">
when I try do do a HTTP request like: /whatever/request I get the following exception:
javax.servlet.ServletException: File "/whatever/header.jsp" not found
The same exception will happen if I try any path instead of /test above for instance /test/test/request or anything.
When I removed all the directives everything is fine. How do I workaround this.
It looks for jsp relative to context path, in your example it looks for jsp stored in /whatever/header.jsp and it is not there, you should access jsp files by writing their full project's path, otherwise it will look for those jsp in the exact folder you are referring to in your url, if it shows error in folder /list/London, and you include jsp like
<jsp:include page="some.jsp"/>
Then it will look for that file in /list/London/, but if you write
<jsp:include page="/some.jsp"/>
It will look for it in your project's root, meaning under /
I have configured Jetty at my Project (Eclipse Neon).
I've created index.jsp under WebContent folder, and my Java class is under WebContent/WEB-INF/classes/foo. The class name is FooClass.java.
At index.jsp, I've set this:
<jsp:useBean id="R1" class="foo.FooClass"/>
Eclipse is alerting me on the useBean tag saying foo.FooClass is an undefined type. What have I done wrong?
Unless WebContent/WEB-INF/classes is listed on the project's Java Build Path as a Class Folder or a Source Folder, and not just an output folder that you've added the class file to yourself, it won't be found by anything the project attempts to compile or validate.
My JSP instantiates a MovieDetails class. I am currently working using scripting to ensure everything is working fine, before I move to tags.
I am using Tomcat 8.0. Directory structure for MovieDetails.class: com/library/model/beans. A copy of the directory structure with the MovieDetails.class file is also placed under WEB-INF/lib (have tried putting a .jar for the file too)
In the JSP I have:
<%# page import="com.library.model.beans.*" %>
And later:
<%
MovieDetails movDet = (MovieDetails)request.getAttribute("MovieDetailsBean");
....
....
%>
I am getting:
java.lang.NoClassDefFoundError: com/library/model/beans/MovieDetails
Can anyone please tell me why the JSP can't find the class in spite of the class being in the /lib directory?
NoClassDefFoundError and ClassNotFoundException is two different exception
<c:url var="addAction" value="/user/add"></c:url>
warning:The tag handler class for "c:url"
(org.apache.taglibs.standard.tag.rt.core.UrlTag) was not found on the
Java Build Path
I have included the JSTL jar but still it gives same warning.
Is any other jar required?
You have to add standard.jar as well.
Did you include the jar files into the correct directory?
They need to be stored in the lib folder in WEB-INF (...WebContent/WEB-INF/lib/).
You may have just stored them in the WEB-INF folder.
I am creating one project in which I am making call to a JavaScript function which resides in index.jsp from my java class ( .java file). As in this context we shouldnt write <script> tag in our index.jsp, what should I do if I want to make use of some dependent .js file like stomp.js source file in my index.jsp file??