PDA

View Full Version : Problem with html style comments in ie7



sandhya.agarwal
8 Aug 2009, 1:29 AM
Hello,

I have a JSP with Ext.onReady() function. I have a html style comment within this function. I noticed that due to this, the page does not get rendered in IE 7. When I change the HTML style comment (<!-- comment -->) to JSP style comment ( <%-- comment --%>), it works. Any reason for this behaviour. Please let me know.

Thanks,
Sandhya

Animal
8 Aug 2009, 1:32 AM
Well it's not valid Javascript syntax is it?

Javascript commenting is the same as Java.

sandhya.agarwal
8 Aug 2009, 1:50 AM
Thanks for the reply. You mean I can use only JSP style comments (<%-- --%>) within Javascript ? Firefox does not complain though.

Animal
8 Aug 2009, 2:26 AM
I said Java, not JSP

// is a comment in javascript

/* is a comment in javascript */

sandhya.agarwal
8 Aug 2009, 3:03 AM
Thanks. The JSP style comments work too but may not be the right way.

Animal
8 Aug 2009, 3:10 AM
Depends what you want to actually happen.

JSP style comments are for people who maintain the JSP. They won't go into the final page because the JSP processor discards them.

If you use Javascript style commenting in your scripts in the page, they will end up in the final page, and so they can be read if people do "View Source", or if they debug the page in the browser.

It's up to you.

sandhya.agarwal
8 Aug 2009, 3:17 AM
Yes..My concern is just that even the html style of comments works in firefox (though this is not the right way as you say) but IE 7 fails to render the JSP.