File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes How to compile JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to compile JSP?" Watch "How to compile JSP?" New topic

How to compile JSP?

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello JSP experts,
I am a novice in using JSP.I use tomcat 3.1 for the same.
How to compile jsp file ,what i mean exactly is how do we know simple Java & related errors without actually having to invoke the jsp page thru the browser. I know that if there is any error the same can be viewed on the browser screen when the JSP is invoked.But is there a way where in atleast the translation time errors are done away with before viewing in the browser.
Thanx in advance,
Brett Knapik
Ranch Hand

Joined: Oct 15, 2000
Posts: 255
As far as I know you can only compile a jsp page when it is invokled by the browser
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
There is no "standard" way to do this. It depends on which servlet container you are using. I know that Resin has a way of doing this, and I guess thatn Tomcat does too. Please check out the web site or mailing list of the container you are using.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
Tomcat does it???/
Please tell me how
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Tomcat's JSP compiler is named "org.apache.jasper.JspC". Check out the jspc.bat or scripts in the tomcat bin directory.

An IDE is no substitute for an Intelligent Developer.
Venugopal nandikolla

Joined: Feb 02, 2001
Posts: 22
I have tried it long time ago.It'll work ,try using the command below.You must specify the uriroot (The root directory of your input files -- jsp's).The -webxml creates web.xml(but you must use -webapp as show below).The c.jsp is my only jsp in the c:\.Hope this will help you.
jspc -uriroot c:\ -webxml c:\web.xml -webapp c:\ c.jsp


Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
Thank u all for the responses
I did try the jspc but it gives me exception IllegalArgumentException. Unknown object java.util.Hashtable etc.
please explain in detail the options of jspc. and till which directory i got to give
I agree. Here's the link:
subject: How to compile JSP?
jQuery in Action, 3rd edition