Deepth Dinesan wrote:
> but no mention about these servlets is given in the
> web.xml deployment descriptor

Just because someone implements it does not mean it is right. Servlets
that are deployed for use need to be defined in web.xml, however,
servlet classes can be used creatively. For instance, I recall Tomcat at
some point in time having a Servlet which would auto-run other Servlets
if you gave the class name. It worked as an example, but doesn't mean
you should try to do that with a web app.

Do use the specs to see what should be done. If in doubt see what Tomcat
does, it is the reference implementation.

> in websphere no precompiled JSP servlets are present only the jsp files
> are present under / .

Once a JSP is compiled the .class file can go where the vendor likes. It
is not like Sun's javac which by default puts .class files next to the
.java they were compiled from. You can't look under the web app root, /,
and expect to find compiled JSP.

> > what are the pros and cons of using precompiled JSP s?

Precompiled JSP load and are ready for use a little faster. A container
doesn't have to translate and compile a precompiled JSP.

There might also be some other reasons due to your specific container or
project.

> > "JSP spec says that its more likely that JSP files are shipped in the
> source form....." why is it so ?

It is easier? There is no superb reason, it depends on what you are doing.

> can I create a WAR that doesnt contains JSP source but contains only the
> precompiled servlets....if one does like that y should
> he do it...

Yes(so I think, you should double-check the spec), if you don't want
people to have your JSP source-code. Usually it doesn't matter,
especially if you follow a design pattern such as MVC.

Keep in mind a WAR is just a ZIP of a web application. Anyone can unzip it.

> <!ELEMENT jsp-file (#PCDATA)>
>
> but few war files that I have went thru doesnt use this.

A JSP is normally auto-deployed to a URL extension that matches the name
of the JSP file. However, what do you do when you need to define initial
parameters for the JSP or if you want to map other URLs to the JSP? This
element lets you do it. Without it you can't.

Commonly you don't need to do this, but, one day you might.

> in a nut shell which is the preffered way for packaging JSPs

Again, it depends on what you are doing.

Personally, when I have to use a WAR for something I like to clean out
all the unneeded files (such as backup files, or files not related to
the web app) and ZIP up what is left. I leave in the source files
because they are important. Unless you *must* hide them, why bother?

Cheers,

Jayson Falkner
[EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to