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 JSP compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP compilation" Watch "JSP compilation" New topic
Author

JSP compilation

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
Hi,
I have a query.

When we run a jsp page for the first time it takes time to execute as the jsp turns into servlet(that is translation and compilation).Now if do some changes in the jsp and with out restarting the serfer does the same translation and compilation take place.


Thanks,
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Yes.
The container compares the JSP and generated servlet's class file with each request and recompiles the JSP if it is new.

Note: Some containers can be configured to disable this in production environments, for performance and/or security reasons.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61610
    
  67

You might be interested in this article.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sreejith sree
Greenhorn

Joined: Feb 18, 2008
Posts: 2
tomcat will constantly moniter the java server pages deployed in the web-inf directory for changes.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,

you can change the jsp at run time , but cant change the servlet class at run time , i think, i want to work on this matter ,


sreejithsssss
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by sreejith sree:
tomcat will constantly moniter the java server pages deployed in the web-inf directory for changes.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,

you can change the jsp at run time , but cant change the servlet class at run time , i think, i want to work on this matter ,


A few corrections.
There is no "web-inf" directory.
Java is a case sensitive language and that directory is spelled "WEB-INF".
This might sound like nit picking but it throws a lot of beginners off so I point this out whenever I see it.

when ever a new page is requested, every time , jsp page will compile to corresponding servlets , a java class file , and dump the output as raw html,


This is not true.
JSPs are only compiled to servlet code once in the life of the application unless the JSP file has been altered. The output, is not necessarily HTML.

Also, many containers have settings to automatically reload the app if any class files are updated. Tomcat does this with the autoReload attribute of the Context entry. With Tomcat, you can also configure it to watch any file for changes and automatically reload the application. I believe Resin can be configured to watch Java source files and automatically compile them with an app reload when they change.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP compilation