Reputation: 14418
I have a text.class file that is in the same directory in my .jsp file, how can I include it in my jsp file? usually all of the classes should be in the WEB-INF,however I can't put it there.. Usually what I do is:
<%@Test.test" %>
where Test is a folder in the WEB-INF, so how can I do this now?
Upvotes: 0
Views: 1105
Reputation: 13468
Not really an answer, but a warning you should check. Putting your class files at your JSP folder can lead to security concerns. The servlet container allows HTTP access for everything under the root web application dir (or inside the war file) but the content of the WEB-INF and META-INF folders. These folders are protected by default.
If you put a class at a different location, somebody could access an download it just writing the URL at his browser nav bar:
http://host:port/appContext/Test/test.class
I don't know if your app handles sensitive data, or your class contains code accessing main components of your application, which could be exposed if someone downloads and decompile your code: it is kind of a serious security risk.
Rethink your app structure, an keep your classes under the WEB-INF/classes dir. Or at least, configure your container or your web app to forbid access to *.class resources via HTTP requests.
Upvotes: 0
Reputation: 240860
<%@ page import="Test.test" %>
Provided that Test.test is in your classpath .The better place is to put it is:
WEB-INF/classes/Test/test
Upvotes: 1