File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Expression inside a comment is evaluated? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Expression inside a comment is evaluated?" Watch "Expression inside a comment is evaluated?" New topic
Author

Expression inside a comment is evaluated?

C Vivek
Ranch Hand

Joined: Oct 03, 2004
Posts: 115
I had the following piece of code which throwing a error.



JSP was throwing a compilation error even after commenting the above line.
When I removed the line, the JSP is running smoothly. I only doubt is why would the compiler evaluate a JSP expression when it is hashed(commented) ??


Regards
Vivek
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

JavaScript comments, like HTML comments (and Javascript and HTML themselves) are not parsed by the JSP compiler. They are just text and get passed to the browser like any other text.

If you want to comment out your server side code, you need to use JSP or Java comments.

JSP comments look like this:


Java comments are the same as Javascript comments but must be inside a scriptlet to treated as server side code.



Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Expression inside a comment is evaluated?
 
Similar Threads
Post date is not shown
Null Pointer Exception in jsp
Cannot print exception message
html:options values getting appended
A few clarifications needed please...