JSP Comment
<%-- comment text --%> - this is the format of the JSP comments specified in the JSP Specifications. A JSP Comment is removed by the JSP Engine at the translation time itself and the compilation unit doesn't contain them. The comment processing in JSP is very similar to what we have in any other language. Comments don't need to ne compiled as we all know that they are not executed and they simply serve the purpose of making the source code more readable, and maintainable.
HTML Comment
- this is the syntax of an HTML comment as specified by the HTML Specifications. A JSP page considers this as a normal HTML tag and hence it doesn't remove them. All HTML comments are maintained in the response and one can easily see them jusy by viewing the page source of the rendered HTML page in the browser.
Difference between JSP Comment & HTML Comment
JSP Comments are removed by the JSP Engine during the translation phase (JSP Comments are not even part of the compilation unit) whereas the HTML Comments are treated like any other HTML tage and hence they are maintained throughout. This is reason why we can easily see the HTML comments in the browse by viewing the source of the page.
What about // or /*...*/? Are they JSP Comments?
No... they are only Java comments. Since, we are allowed to embed Java code into a JSP page, hence we can have them in a valid JSP page. These comments are treated the same way they are treated in a normal Java program. They all are removed before compilation and like JSP Comments they are also not part of the compilation unit.
April 19, 2018 at 4:04 AM
Hey
There,
Thank you! Thank you! Thank you! Your blog was a total game changer!
I am going to
implement the blackbox class "messagePool". Details are as below. I
just want to implement it so that the whole application can run.
// Call messagePool
Java Code:
Dac dac =
GenericDac.getInstance();
String result =
dac.getMessagePool().getMessage(languageCode, key);
public abstract interface Dac extends java.io.Serializable{
public abstract void init(javax.servlet.ServletContext
arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3,
java.lang.String arg4) throws com.jos.adf3.core.exception.DacInitException;
public abstract com.pool.MessagePool getMessagePool();
}
public class GenericDac implements Dac{
private com.pool.MessagePool messagePool;
}
Super likes !!! for this
amazing post. I thinks
everyone should bookmark this.
Regards,
Morgan
Post a Comment