• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between translation and compilation errors in a JSP

 
Luis Javier Jimenez Ordas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I know whether a piece of a JSP code will raise a translation or a compilation error?
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luis Javier Jimenez Ordas wrote:How can I know whether a piece of a JSP code will raise a translation or a compilation error?

Well, translation errors are more related to syntax errors in your JSP (tags, tag attributes etc..). And the compilation errors are just like errors you get when compiling a normal class (in this case the servlet class which was translated from JSP).
 
Nabila Mohammad
Ranch Hand
Posts: 664
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read this some where but can exactly remember..

like... JasperException is for compilation error
And there was some other error which was for Transalation Error.
And that's how you come to know the difference...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JasperException is for compilation error

JasperException is a Tomcat thing, you don't have to know about it. Vijitha's explanation makes more sense
 
Luis Javier Jimenez Ordas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK Vijitha Kumara, but it's a little tricky in this case:

<%@page session="false"%>

<% out.print (session.getAttribute("myAttribute")); %>

I got to know by heart that this is a Translation error, but in Java if I use something that it's not declared (that's what the page session directive does, declare an implicit "session" object in the implicit servlet that creates when translate the JSP) I raise a compilation error, so the translation not only "translates", but also validates that, in the case the session atribute is false, there is no reference to the session implicit object. I've seen in the Charles Lyons' book (SCWCD Study Companion) several cases in which a translation error is raised. I just wondered if there was a way to know how the translation proccess worked, but once I have studied the chapter, doesn't seem to me very difficult to memorize a few cases...

Thanks a lot
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you try this you will get a compiler error not a translation error, as it's not possible to detect it at the translation phase. It's the compiler's responsibility.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic