A comment...

Yes, you can put comments in your JSP. If you’re a Java programmer with very little HTML experience, you might find yourself typing:

// this is a comment

without thinking twice. But if you do, then unless it’s within a scriptlet or declaration tag, you’ll end up DISPLAYING that to the client as part of the response. In other words, to the Container, those two slashes are just more template text, like “Hello” or “Email is:”.

You can put two different types of comments in a JSP:

  • <!-- HTML comment -->

    The Container just passes this straight on to the client, where the browser interprets it as a comment.

  • <%-- JSP comment --%>

    These are for the page developers, and just like Java comments in a Java source file, they’re stripped out of the translated page. If you’re typing a JSP and want to put in comments about what you’re doing, the way you’d use comments in a Java source file, use a JSP comment. If you want comments to stay as part of the HTML response to the client (although the browser will hide them from the client’s view), use an HTML comment.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset