• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why jsp compiler creates exception(jasperException)during compile time,but incase of javac its not?

 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Why jsp compiler creates exceptions( jasperException) during compile time, but incase of standalone programs,(using javacompiler) its not?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Why jsp compiler creates exceptions( jasperException) during compile time


Can you explain what you mean by creating exceptions ?
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In standalone java, if there is undefined symbol used,(if the variable 'a' is not declared anywhere, and if we call like, System.out.println(a); it will show an error, and no exception object, but incase of jsp if we call out.println(a);(provided 'a' is not declared anywhere),it will throw jasperException. What is the reason? Thankyou.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is Tomcat's way of telling the user that its JSP cannot be compiled. I think it's a design decision to do so. Jasper (Tomcat's JSP Engine) translates the JSP into a servlet and tries to compile it. You will agree that throwing an exception is a common way to tell that something went wrong, and that's what Jasper does.
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou Sir. What is the reason for creating exception object, instead of just showing there is a syntax or symmantic error, like incase of what java compiler do, without creating an exception object? What may be the design issues that jasper compiler keep in made. Please reply.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Imagine the scenario. Jasper tries to compile and find an error. Jasper has nothing to do with the user interface. Where is he going to send the error message ? I think the best way to do it is to throw an exception and let the caller show the error where it wants, and the way it wants.
 
Chinmaya Chowdary
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou Sir.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic