File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Is it possible to dispatch a JSP from a JAR file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Is it possible to dispatch a JSP from a JAR file?" Watch "Is it possible to dispatch a JSP from a JAR file?" New topic
Author

Is it possible to dispatch a JSP from a JAR file?

Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
I'm wondering how far I can separate some concerns in some code I'm writing here. It would be quite useful if there was a way to put some JSP templates inside a JAR file along with their associcated classes and then be able to getRequestDispatcher("/somewhere/in/jar/file.jsp").forward( ... );. Is there a way to handle that?

I'm not looking for a WAR file though... this will basically be support code which just sits in lib.

Cheers,

Chris
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you pre-compile your JSPs you could store the class files in a jar and map them the same way you would any other servlet.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chris Corbyn
Ranch Hand

Joined: Jan 14, 2007
Posts: 114
Hmm, I never thought of doing that, thanks. Actually I may have to change some code (for the better) to take this sort of thing into account.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it possible to dispatch a JSP from a JAR file?
 
Similar Threads
New Article: Constant Constants Consternation
Jar integrity
Calling JAR file in JSP form
When tomcat starts...
jsp - jar - dll