Precompiling JSPs in Eclipse
November 26, 2005 3:20 PM   Subscribe

How do I precompile JSP pages in Eclipse?

I have tried Googling and search the Eclipse help. I don't want to precompile in the server, but rather in the IDE. And I tried just adding them to the build path, but nothing happened.
(I want to skip the load/request part of testing to hit errors earlier)
posted by andrew cooke to Computers & Internet (4 answers total)
Best answer: In the Nitrox JSP Eclipse plugin's debugging explanation, they claim that there's no way to know until runtime what the JSP will look like. A telling quote: "...JSP files end up being compiled by the web container (or application server) into a Java file and do not exist in the same form that the developer knows them."

Admittedly, I don't know much about JSP, but maybe this is why the Eclipse project hasn't attempted this?

That said, it sounds like there's a command-line precompiler. And the Eclipse folks themselves seem to have punted on JSP entirely. They point people to IBM's platform instead.

So, two thoughts:

1. Your only hope is probably an Eclipse JSP plugin that includes a JSP "builder". Builders are the part of the Eclipse IDE that perform compilation and syntax checking. Try Googling around for something like "Eclipse 'jsp plugin' builder precompile" or some combination of those words.

But I doubt such a thing exists. If it did, it would migrate into Eclipse itself pretty quickly.

2. If I were in your shoes, I'd give Nitrox a whirl to see where that led me. They seem to have thought about issues like this.
posted by maschnitz at 5:25 PM on November 26, 2005

Response by poster: thanks for such a detailed answer to what i thought was an impossible question.

i don't understand why it's not possible to do this. it seems that various containers/servers do precompile jsp pages (i managed to find instructions for a couple while trying to find out if it was possible in eclipse - it boosts peformance the first time the page is requested).

but it's late here - maybe i just need to read the nitrox page again tomorrow and it will be clear. anyway, nitrox looks really interesting. i will check it out. thanks again.
posted by andrew cooke at 5:38 PM on November 26, 2005

Best answer: While maschnitz is right about an IDE not knowing what a JSP page 'looking' like (they are dynamic code after all), not compiling them is just silly. It's just inside out java code.

Also, he is 100% right about that if it was possible, it would migrate itself into the Eclipse project. Hence the Web Tools Platform which allows JSP editing, compile-in-place, code completion, and deployment.

The only things that NitroX has over the Eclipse foundation effort is a bit of maturity (the web tools project is still very beta) and a visual JSP editor.

Now, NitroX has just been bought by BEA. That can be a good or bad thing considering where you stand, but I never met an IDE that BEA couldn't screw up (cough VisualCafe cough)
posted by PissOnYourParade at 5:48 PM on November 26, 2005

Hmmm....yeah, i guess you're right, POYP.

I think the point the Nitrox folks were making was: typically, JSP pages are compiled at runtime, not compile-time, in more-than-normal-complicated environment. On top of it, are there import statements or any other help for the compiler? If not, the IDE would have to be told what that environment is, in some way.

This all adds up to: it's possible to make such an IDE, but not easy, and not a standard Java thing to do.
posted by maschnitz at 5:57 PM on November 26, 2005

« Older Spring Break travel without the Spring Breakers   |   What to do/see in San Jose? Newer »
This thread is closed to new comments.