6

I have thousands of Java files and same JSP files in my project. I am compiling that project with an Ant build script. The problem is when I compile that project and generate the WAR files of that project. Then at that time, if there is any error in a Java class, it will give me an error that there is a syntax error in the Java class, but what if I want to get the syntax error of the JSP pages?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bhavik Ambani
  • 6,557
  • 14
  • 55
  • 86

3 Answers3

5

For Ant, see Ant JSPC. For Maven, see Maven JSPC.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ichaki5748
  • 1,993
  • 1
  • 14
  • 13
0

If you are using any IDE then it will show all syntax errors there.

gprathour
  • 14,813
  • 5
  • 66
  • 90
  • But what if I want to know at the compile time ? – Bhavik Ambani Jan 27 '12 at 05:20
  • @BhavikAmbani You can't, I think. Bcoz JSP are not compiled like Java Classes. They are compiled when requested for the first time by the browser and then converted to servlets... – gprathour Jan 27 '12 at 05:26
  • I know that, but is there any API available for that or ? My actual problem is when I make any changes in any Java file then I have to search there is there any effect of that in any JSP ? By making search, then only I can make change and if I fail to find that then at run time it will throw an exception and then I am able to find the problem. – Bhavik Ambani Jan 27 '12 at 05:30
  • @BhavikAmbani if you are making any change to your Java class and want to see its impact in your JSP, then it will not give you any Syntax error. It is matter of some logical thing. May be you can get any Logical error there but not syntax. – gprathour Jan 27 '12 at 05:33
  • But what if I have made change in medhod name, public static variable final variable name etc. – Bhavik Ambani Jan 27 '12 at 05:42
  • @BhavikAmbani it will not be a **syntax error**. Its logical error. You your self need to find where you have used that method/variable and rename it. – gprathour Jan 27 '12 at 05:45
0

JSP files are not compiled by Ant (at build time) like Java classes. They are translated into a servlet by the JSP engine in the server when they are requested for the first time. See How is a JSP page invoked and compiled?.

So, GP Singh is right, use an IDE.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142