aspose file tools*
The moose likes JSP and the fly likes JSP Compilation doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Compilation doubt" Watch "JSP Compilation doubt" New topic
Author

JSP Compilation doubt

Srini Krishnan
Greenhorn

Joined: Jul 08, 2005
Posts: 12
Hi,
I am using weblogic 8.1 server. My web application is deployed as WAR file.When jsp is executing,jsp is converted into .java file which in turn compiled into .jsp file.
The jsp working directory is specified in weblogic.xml.
So whenever i request for a jsp file,it is either takes a compiled class file or compile .jsp to java and then into class and then it will executed.

As per my understanding,the jsp files are complied into jsp working directory. So whenever we request,the container will instantiate the class from jsp working directory(which is not part of WAR). If jsp working directory is part of WAR file,then when will the jsp file gets compiled?.

So if jsp working directory is part of WAR file,then it has to be compiled before making the WAR. If it needs to be compiled before making WAR,then how can we compile the jsp file?

Thanks in advance

Srini


Thanks<br />Srini
jiju ka
Ranch Hand

Joined: Oct 12, 2004
Posts: 306
I work in websphere. The JSP engine and servlet engine are the same in both websphere and weblogic. So the run time and compile time behaviour for JSP's are assumed same in both application servers.


When jsp is executing,jsp is converted into .java file which in turn compiled into .jsp file.

I am correcting the above statement as follows: When a JSP is compiled, a servlet is generated which is a .java file which in turn is compiled into a .class file


whenever i request for a jsp file,it is either takes a compiled class file or compile .jsp to java and then into class and then it will executed.

When a jsp file is requested at runtime the JSP engine checks whether the JSP is already compiled. If the JSP is not compiled compilation will be done. Modified timestamps on the .class file and .java is also compared to determine whether the JSp is compiled.


when will the jsp file gets compiled?

At runtime. Ex: jsp called hjui.jsp is not compiled until http://.../hjui.jsp is called or another action is forwarded to this JSP.


So if jsp working directory is part of WAR file,then it has to be compiled before making the WAR.

JSP working directory which contains the .class files is not part of WAR. In WSAD development workpace this location is generally \\[workspace]\.metadata\.plugins/com.ibm.etools.server.core/tmp1/cache/localhost/server1/[applicationName]/ApplicationName.war
Please identify this location in weblogic and recognize this as cache and not WAR.

When you make the WAR the JSP's goes in the WAR. You are right the source code goes in the WAR.


So if jsp working directory is part of WAR file,then it has to be compiled before making the WAR. If it needs to be compiled before making WAR,then how can we compile the jsp file?

With the above said if you have a restriction on deploying source code, you could alternatively try to compile the JSP's before deployment. But I haven't done this before. I heard people talking about this. If you are interested in this please specify.
[ November 11, 2005: Message edited by: jiju ka ]
 
jQuery in Action, 2nd edition
 
subject: JSP Compilation doubt