aspose file tools*
The moose likes Struts and the fly likes Commented tag still Executed! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Commented tag still Executed!" Watch "Commented tag still Executed!" New topic
Author

Commented tag still Executed!

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
My welcome.jsp has these lines:

<html><head></head><body>
forward to anther page
<!-- <jsp:forward page="/Lookup.do"/> -->
</body>
</html>

I commented out the forward but the page is still got forwarded! Instead, I need to use alternate comment syntax:

<html><head></head><body>
forward to anther page
<%-- <jsp:forward page="/Lookup.do"/> --%>
</body>
</html>

Wrong is wrong with it? Is the <jsp:forward> preprocessed before the comment? I was using tomcat-5.0.29 during the test.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5288
    
  10

You need to use JSP comments, i.e., <%-- --%> instead of HTML comments.

Edit: Of course, you already realized that. The reason for this is that JSP translator does not recognize HTML comments; it's just text that it sees needs to be included in the response. Regarding your question about "pre-processing", the answer would be yes because a JSP is translated into a Servlet.

The text in your JSP:

<html><head></head><body>
forward to anther page
<!-- <jsp:forward page="/Lookup.do"/> -->
</body>
</html>

would be translated into code that would essentially function like this:

out.println("<html><head></head><body>");
out.println("forward to anther page");
out.println("<!-- ");
jspForward("/Lookup.do");
out.println("-->");
out.println("</body>");
out.println("</html>");


whereas this

<html><head></head><body>
forward to anther page
<%-- <jsp:forward page="/Lookup.do"/> --%>
</body>
</html>

would be translated as

out.println("<html><head></head><body>");
out.println("forward to anther page");
// Comment: <jsp:forward page="/Lookup.do"/>
out.println("</body>");
out.println("</html>");
[ May 05, 2005: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Commented tag still Executed!