• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploying Precompiled JSPs on iPlanet

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I would like to deploy the JSPs as pre-compiled class files. I unsuccessfully tried to deploy the generated class files as servlets.
Steps followed were:
1) Pre-compile the JSPs into java files using Jasper.
2) Compile the java files to class files.
3) Map the JSP name (for e.g. test.jsp) to the corresponding .class file (i.e. _test_jsp.class)
I get a NullPointerException when I access the JSP (and its not in my code). Anybody run into similar problems ? I am using a iPlanet webserver on a unix platform.
I would appreciate if someone could give me some pointers on how to go about to do this. Specific details about iPlanet webserver will be great.
Thanks
Ashwin.

[This message has been edited by Ashwin Desai (edited October 01, 2001).]
[This message has been edited by Ashwin Desai (edited October 01, 2001).]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been wondering about this for some time.. Is there any advantage in manually precompiling a JSP versus just registering it as a servlet in web.xml, and setting it to load on server startup. For example:
I tried this, and it works fine. The server automatically compiles and loads the JSP file as a servlet when it starts. So what is the benefit of going through the trouble of manually compiling the JSP? Please respond.
Regards,
-Miftah
 
Ashwin Desai
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
There could be a lot of reasons, but the following two affect my decision.
1) Licensing issues prevent distributing the javac compiler with software. Thus, jsps cannot be evaluated on the fly.
2) You do not want to give out your code i.e. jsp files. Thus, just give compiled versions.
Ashwin.
[This message has been edited by Ashwin Desai (edited October 01, 2001).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aaah, never thought of it from a vendor's perspective. Thank you Ashwin.
Regards,
-Miftah
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Um, why would you need to distribute the compiler?
If you are selling software written in JSP, well, your customers need a JSP/Servlet engine to deploy on, right? Every Servlet engine that I am aware of is distributed with an appropriate compiler and automatically compiles the JSPs you provide according to your XML deployment descriptors... In fact, I'm relatively certain that this is a REQUIREMENT of the JSP/Servlet specification.
So, why worry about distribution of the compiler?
[This message has been edited by Dave Soto (edited October 01, 2001).]
 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And unless you obsfucate your precompiled servlets, I can decompile them with very little work!
Pho
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I can decompile them with very little work

I'm curious.. How would one do that?
 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two responses, Ashwin:
1: Another iPlanet user! Write to MooseSaloon@javaranch.com and help lobby for a dedicated iPlanet forum! They have WebLogic and WebSphere, but not iPlanet, and heck if we don't need a little help!
2: JSPs (on iPlanet at least..) are expected to be packaged as jsp.APPS.<webapp name>. There's some additional factors involved, but suffice to say precompiling your JSPs isn't a particularly good idea. If you really need to have something precompiled, servlets and good ole java classes are the best option. If all of your 'real' logic is there, and the JSP is just presentation (as it should be), then viewing the JSPs won't cause any proprietary 'secrets' to be lost, just the API for using the data/logic classes. Hope this helps!
BTW, if you adhere to the MVC design pattern, the best way to develop is write your data/logic classes as regular java, write a front-end to accept posts and parameters as a servlet that calls the data/logic classes as appropriate, take the results and add them to the request via the setAttribute() call on the HttpServletRequest, then finally forward the request to a JSP for display. If you're still worried about the JSP, you can write precompiled JavaBeans and/or custom tags for manipulating your presentation without others viewing it. I don't both with that, though. I use the following method to do forwarding, where templateName is the name of the JSP file:
<pre>
public void forwardToJSP( HttpServletRequest req, HttpServletResponse res, String templateName )
throws ServletException, IOException
{
// select the JSP template
RequestDispatcher disp;
disp = getServletContext().getRequestDispatcher( "/" + templateName );
// forward the request to the template
disp.include(req, res);

return;
}
</pre>
Cheers!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic