• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JSP Compilation doubt

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic