saulenzo7
saulenzo7

Reputation: 51

What is the easiest way to hide HTML code from users eye?

I am currently working with JSP pages and would like to know what would be the easiest way to comment HTML/Java code from being able to see it when you open source on the web. As for now, I was used to use

<%-- html/Java code --%>

However, later on it screw up all highlighting of JSP file. Maybe there is another way of commenting multiple lines without possibility to see them in HTML source on web.

Upvotes: 1

Views: 556

Answers (2)

AGE
AGE

Reputation: 3792

I would like to quote Oracle on this one: Code Convention

Please note the following (excerpt from the link):

  1. JSP comments (also called server-side comments) are visible only on the server side (that is, not propagated to the client side). Pure JSP comments are preferred over JSP comments with scripting language comments, as the former is less dependent on the underlying scripting language, and will be easier to evolve into JSP 2.0-style pages.

Examples:

<% /** ... */ %>
<% /* ... */ %>
<% //... %>
<% //... %>
  • Client-side comments can be used to annotate the responses sent to the client with additional information about the responses. They should not contain information about the behavior and internal structure of the server application or the code to generate the responses.

Let's note that these comments:

<!-- ... -->

ignore all elements except @import statements.

Upvotes: 0

Razib
Razib

Reputation: 11173

Look:

<%-- Comment --%>  - commenting out html

<% /*java code*/ %>  - commenting out java code  

<!-- comment --> - html comment, ignored by the browser

Upvotes: 3

Related Questions