Compiling JSP files

When you build a project, the project's JSP files are only built if you have selected the "Test compile all JSP files during builds" checkbox (in the Compiling panel of the Project Properties dialog box). (Until yesterday, I had assumed that JSP files are compiled when a project is built.) This is pretty cool. If the JSP files were automatically included in the build, you might have to wait a very long time for your builds to complete -- because each JSP file is translated to a servlet before it is compiled. With the Tomcat Web Server (not sure yet about Sun Java System Application Server), the only time when a JSP file is automatically compiled is when it is accessed by a user, which means that your web application could be up and running for weeks and weeks before compilation errors are discovered... So setting that checkbox (or manually compiling JSP files) is pretty useful, even though it might slow a lot of things down, because otherwise compilation errors might be discovered when it's too late.

By the way, you can also view the translated JSP file (right-click the JSP file and choose "View Servlet"). But this is only possible after you have deployed it. This, in turn, means that the servlet you see is the one that is created by the server, which could be slightly different to the one that the IDE creates.


How do you prevent NetBeans from trying to compile jsp files that are only supposed to be included in other jsp files. NetBeans gives a lot of errors because these files will never compile standalone. Also NetBeans stops compiling remaining files as soon as it fails to compile the first jsp file. Is there a way to tell NetBeans to continue compiling the remaining jsp files ?

Posted by sohaib on February 03, 2006 at 01:44 AM PST #

Hi Sohaib, I asked some developers about this and the answer is: "JSP compilation can only be turned on/off per project. You can also compile individual files." The suggestion is that you file an enhancement. Maybe, if compilation fails, you should be asked if you want compilation to continue for the other files. Or maybe you should be able to set an option so that compilation continues even when one file fails. Anyway, you can make a suggestion like this in issuezilla on Thanks for the question and for spotting an area where NetBeans can improve.

Posted by Geertjan on February 03, 2006 at 02:01 AM PST #

Hi !

This option is activate in my NetBeans project's properties but I have a lot of warning (warning: [serial] serializable class ...) with the generated servlet.

It's not a problem to finalize compilation but I don't like that.

Have you a solution to insert serialVersionUID in JSP or another thing (except @SuppressWarnings(value="serial")) for eliminate this warnings please.
I don't find solution on Google after few hours.

Best regards, Camille

Posted by Camille on January 30, 2013 at 02:27 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« April 2014