HTML comments and scriptlets

Hey,
I have a question concerning the JSP specification and HTML comments (1.1 and 1.2):
Code like this:
<script language="JavaScript">
<!--
<%
int a;
if (true)
a = 2;
%>
-->
</script>
<html>
<body>
<b>
a = <%= a %>
</b>
</body>
</html>
prints print out:
a = 2
with Tomcat 4.0.x , but not with Orion 1.5.x. Orion ignores the scriptlet code within the HTML comment.
Both blame to be JSP compliant in that respect. The specification says (1.1 chapter: 2.3; 1.2 chapter: 2.5):
In order to generate comments that appear in the response output stream to the requesting
client, the HTML and XML comment syntax is used, as follows:
<!-- comments ... -->
These comments are treated as uninterpreted template text by the JSP container. If the
generated comment is to have dynamic data, this can be obtained through an expression
syntax, as in:
<!-- comments <%= expression %> more comments ... -->
Now, does this mean JSP scriptlets (<% scriptlet %>) in HTML comments are ignored or not?

This is a known bug in the Orion server; using the Oracle Containers for J2EE, which is the Orion server under license, I often have to deal with the same problem.
Either don't remark out your JavaScript files, or place your HTML remarks inside JSP remarks so the Orion server can parse it correctly:
<script language="JavaScript">
<%="<!--"%>
<%
int a;
if (true)
a = 2;
%>
<%="-->"%>
</script>

Similar Messages

  • HTML Comments in a JSP Document

    I am writing a JSP Document that has a number of comments. Some I want to be server-side such as version history and some I want to be client-side.
    Using a JSP page this is easily achieved using JSP comments <%-- JSP comment for server-side --%> and HTML Comments<!-- HTML comment client-side -->.
    Using XML syntax a number of things are apparent:
    1. There is no XML equivalent of a JSP comment (this has been well doc'd for a long time).
    2. In the Java EE tutorials the recommended alternative to a JSP coomment is a HTML comment.
    3. Using HTML comments in a JSP document the web container omits these in the page output - and so they are server-side only just like a JSP comment.
    Code Snippet:
    <template xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="1.2">
    <!-- this comment will not appear in the generated source on the client browser -->
    </template>
    <!-- JSP fragment for no caching policy -->
    So, my question is how do I generate a client-side comment in a JSP Document?
    Thanks
    Edited by: DJT on Mar 3, 2008 4:28 AM
    Edited by: DJT on Mar 3, 2008 4:30 AM

    I found this ....
    http://www.javaworld.com/javaworld/jw-07-2003/jw-0725-morejsp.html
    One significant disadvantage of JSP documents is that no XML-compliant version of JSP comments exists. A JSP document developer can use client-side (HTML-/XML-style) comments or embed Java comments in scriptlets, but there is no JSP document equivalent to <%-- -->. This is a disadvantage because the other two commenting styles JSP documents can use have their own drawbacks. You can see the client-side comments in the rendered page using the browser's View Source option. The Java comments in scriptlets require placing Java code directly in the JSP document.
    So try to embed the HTML comment inside scriptlet tags...
    <%
    <!-- HTML comment here -->
    %>

  • HTML Comment Vs JSP Comment

    HTML Comment : <!-- Comment -->
    JSP Comment : <%-- --%>
    1) What is the different between HTML Comment and JSP comment.
    2) How the web container will treat these two comments??
    Regards
    Dhinesh

    Hi,
    JSP comments are used for documenting JSP code and are not visible client-side (using browser's View Source option) where as HTML comments are visible.
    cheers,
    k

  • Html comment in JSP compiled and rendered in NW7.3?

    Hi,
    We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
    Is this correct or is it a bug?
    Thanks,
    Stefan

    Hi,
    We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work.
    Is this correct or is it a bug?
    Thanks,
    Stefan

  • HTML comments not showing up in snippets in RH9?

    I want to be able to add some HTML comments sometimes when I enter content.
    For example, let's say I want a pair of HTML comments like so, with a place for text between them.
    <!-- begin info pulled from the v3 P & P manual -->
    and
    <!-- end info pulled  from the v3 P & P manual -->
    I created a snippet, entering the following using HTML view:
    <!-- begin info pulled  from the v3 P & P manual -->
    <p>Copy the text in here.</p>
    <!-- end info pulled  from the v3 P & P manual -->
    When I dragged the snippet onto the topic, though, the HTML comments (lines 1 and 3 in the example) were missing. That was the whole point of the snippet: To be able to copy in the HTML comment lines.
    I can open the snippet in HTML view, copy the lines, and paste them into the HTML view of the topic, of course, but I'm going to be leaving this project after it's over and don't want to have my successor pulling his/her head out wondering how to get this to work.
    Suggestions?

    No comment is going to appear in Design View, regardless of whether it is in a snippet, an ordinary topic or any page being edited in any HTML editor's design view. That's the whole point of comments, they are something that only appear in the HTML view.
    Maybe you were hoping the content of the snippet appeared in topics rather than just the reference?
    Anyway, I am sure Amebr's excellent alternative approach will work for you.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How to create an interactive magazine with user comments and voting system?

    I need to create an interactive magazine that includes user comments and votes (like/unlike).
    I know that I can create digital swf magazines in indesign and that user comments and like/unlike buttons can be entered with coding in adobe dreamweaver.
    I need this for a school project and I do not know if it's possible or if there is another way of doing it in dreamweaver...
    Thanks

    The easiest way to do like/unlike voting is use facebook´s like/unlike button generator at http://developers.facebook.com/docs/reference/plugins/like/ to create a code. You can set up the appearance and some features of your button and you will end up having an iFrame code. You can add that code into your html-wrapper file with some regular texteditor like wordPad....
    Here´s one example, it´s an InDesign SWF finalized with eDocker but I don´t see any reason why you couldn´t use the SWF exported directly from InDesign as well. If you want to put it to some specific location, you have to wrap it up into a div and set up some css for that div, but it´s not a rocket science either.....=)
    http://www.prepress.fi/keva

  • Html comment around css

    When you have the following code:
    <style type="text/css">
    <!--
    .header {
    font-weight: bold;
    background: #979797;
    -->
    </style>
    What does that mean? This header class will only take effect
    in IE? Or, is does the <!-- and --> do something else?

    Considering the movement towards HTML 5 that day is even less
    likely to
    come though you can use a mime type of application/xml with
    XHTM. IE won't
    like it but you *could* do it. <g>
    Cheryl D Wise
    http://starttoweb.com
    "David Powers" <[email protected]> wrote in message
    news:fm0bl8$7tu$[email protected]..
    > Gary White wrote:
    >> I rarely include html comments in <style> or
    <script>
    >> blocks, just to be on the safe side.
    >
    > I never include them myself, but I think Dreamweaver
    still does when it
    > inserts a script or style block automatically. Given the
    glacial pace of
    > change with (X)HTML, I wonder if I'll ever live to see
    the day when
    > ordinary web pages are served as XML.
    >
    > --
    > David Powers, Adobe Community Expert
    > Author, "The Essential Guide to Dreamweaver CS3"
    (friends of ED)
    > Author, "PHP Solutions" (friends of ED)
    >
    http://foundationphp.com/

  • HTML comment replication

    We recently upgraded from RH5 to RH7 and I am running RH
    version 7.00.145 on my machine.
    After upgrading, we found there were problems with em dashes
    and en dashes, in that they displayed as &emdash; or
    &endash in our output. We corrected this with a search and
    replace, replacing the erroneous code with RH's code (eg <symbol
    name="Em Dash"><robohelp>&#8212;</robohelp>).
    After this, however, we noticed that RH7 sometimes copied
    HTML comments from within the header and inserted them along with
    the code for the em dashes or en dashes. This produces the
    appearance of an extra space in the output.
    The only way we have found of fixing this is to move HTML
    comments from the header to the bottom of the page, then manually
    delete the extra comments around the en or em dash.
    This problem does not happen with every page that has en
    dashes or em dashes and there are no obvious differences between
    pages that are affected and those that are not.
    Has anyone else encountered similar problems? I would
    appreciate any advice on why this problem is occurring and any tips
    on how we can stop this.
    Thanks in advance, Tricia

    You need to install all the patches. There were many serious
    bugs fixed in 7.01 and 7.02. There is also a 7.03 out now, which
    wouldn't hurt to install either. I believe you'll need to install
    all three patches in order. You can find information about the
    patches and bugs on
    Peter Grainge's site.
    I don't think the projects you've opened with 7.00 will be
    fixed automatically by these patches, but any new projects, or ones
    you haven't yet upgraded won't show these issue. For the effected
    projects, if you haven't done anything apart from upgrade them, you
    could restart with backup copies, but that might not be a
    possibility if you've made a lot of changes.
    I'm sure Rick, Peter et al. will jump in with additional
    info, but you can at least have a look at what Peter has already
    put together.

  • How to make the auto generated java script not to have any html comments.

    Hello BEA Experts, As you know that auto generated javascript functions like getNetuiTagNames in Workshop are included with in the the HTML comment tags like <b><!--
    --!></b> its another thing they should be generated correctly as follows <b><!--
    //--!></b>, to hide it from browsers not supporting javascript.
    My question is there any way to stop generation of the HTML comment tags and just genrate the javascript with in teh script elements..
    Please let me know..
    Thanks in advance..
    -Bob F.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • Adding an html comment causes entire table to disappear in CC Design view

    Doing some tweaks to a page in the html editor in DW CC and adding a simple comment <!--BEGIN MAIN TABLE-->  causes the extensive table beneath it to disappear from the design view pane.  But the html is still there in the html editor and the page still appears correctly in a browser. Refresh Design View does nothing. At first I kept Undo'ing it to get back to where I was before adding the comment. Then I thought maybe if I saved the doc after adding the comment it would refresh correctly, but it didn't. Quitting and rebooting DW doesnt help.
    What gives? Now the Design view table is gone.  I can't work like this, without seeing the page I'm working on...
    I can make this same thing happen over and over - which seems to indicate a bug in DW CC...
    I know you pro's are anti-tables but I'm stuck with tables right now...

    Ok I understand about dl'ing files, np.  Heres the page in progress:   {link temporarily removed}  with 2 duplicate table elements below the first, one in the center I was adjusting/adding comment DW has disappeared, the other at bottom intact for backup. Here's what the disappeared version  looks like in DW:
    CC:
    The layout is simple and DW shouldn't prevent me from doing this: I know it could be done with div's and CSS but I'm not going to practice and perfect that for this right now, its already torture enough using DW for this simple thing. It needs to stay as nested tables.
    Despite any method of working - adding a comment should not create this hassle.
    Thanks for trying to help!

  • Comments and Podcasts

    Can some help me get the comments and pod-cast features to work without using a .Mac site?

    For comments, you will use the iComment/Haloscan combo. Read about it here...
    http://web.mac.com/cbrantly/iWeb/Software/iComment.html
    I think this works better and is much more configurable than the Apple commenting system anyway. You can also use iComment to add the StatCounter hit counter, since the Apple hit counter won't work without .Mac either.
    As far as your Podcast goes, everything should function just fine on a non-.Mac server. When you do the "Publish to Folder" routine, though, you need to type in your webserver directory into the URL field so that iWeb can form the Podcast RSS.xml feed file for you. For example, if your host domain name is http://www.mydomain.com that's what you'll need to enter.
    Then when you go to upload your site, make sure that you upload the two things inside the folder where you published to. Those two things should be the index.html file and a folder with your site name. Just add these two items to your FTP program for upload and upload them into the same directory on your server so that they are sitting next to one another.

  • HTML 5 and CSS 3 Support In Dreamweaver CS5

    I cannot find any information on this web site about whether and how Dreamweaver CS5 supports HTML 5 and CSS 3. There are lots of other fancy high-end whiz-bang technologies highlighted in CS5, but without support for HTML 5 and CSS 3, Adobe has left a great big hole in the middle of the new Dreamweaver. If I'm going to have to code these by hand, then there's little incentive for me to upgrade from CS4. Adobe may, by this oversight, intend to extend the useful life of Flash, but if this is so it's penny wise and pound foolish. There is much to like about Flash - and much to dislike about how it works on the user side. Leaving these problems unresolved hurts Flash, and leaving HTML 5 and CSS 3 support out of Dreamweaver hurts Dreamweaver. In other words, this is a lose-lose strategy.

    Hi Scott
    Sorry for the delay in replying, but I turn my internet connection off when working, otherwise I have found I tend to do more research than work.
    Media-Queries:
    I had viewed the video on the possible implementation of media-queries when it was first released, and in most respects the implementation is as I would expect, but it would be helpful if it was, (in a future development of the use) possible to show a list of 'common' smartphone/handheld devices, (makes/models) within the dreamweaver interface that would be usable with the screen size being used, (possibly as an import from the 'device central' device list as a drop-down list). My reason for asking for this feature is primarily as a time saving feature for the css layouts via media-queries as it would then show the targeted/usable devices in a list, and possibly alleviate the requirement of developing layouts that are not really required.
    Video:
    At the moment I am using the video feature as you have indicated where possible, and am doing so with the use of IECC's for IE as a fall-back for that browser. I have tried targeting versions if Firefox and Safari that support the video element by testing for it with JavaScript, but I have found this unreliable, possibly when the standard is finalized this may be the better method.
    SVG:
    I personally have decided to go with svg in preference to canvas. I have seen a few 'wow' factor demo's produced using canvas but as they use cross-compiled java to javascript code they are in reality showing nothing that has not been done before, (If we had 4Ghz processors with multi-core in 1999 similar trial graphics in vml would have worked just as good then, showing my age here!).
    My current work-flow with svg is - Inkscape - Modify the code by hand/preview in a browser - copy/past the code into dreamweaver.
    The current in-line implementation of svg's in the IE9 preview is where I see the main future of the svg implementations, as this makes using svg's for graphic elements and basic animations much more viable/easier for the average designer/developer, and lets not forget that as it is a vector it is ideal for resizeable background images in fluid/liquid layouts.
    I should say here, that I will for the foreseeable future use flash/swf's for more complex animations, as these are still much better quality than anything that can be achieved with svg or canvas.
    I would like to see the possibility of using Fireworks for the creation of svg's, and a work flow similar to that available between fireworks and dreamweaver at the moment.
    Cache manifest and database:
    As you have rightly grouped these two together, (and I cannot really envision a situation that they would not be used so) the situation with these is for me, (when trying to create the code for use) the necessity of 'remembering' what I must include in the cache and the transfer of the data for the database.
    Both are probably better explained with a typical scenario -
    A new research/development firm has developed the technology and parts to upgrade an autos internal combustion engine to an hydrogen powered engine. However the products list is specific to the motor manufacturers engine type, and to make matters worse the sales department also wishes an off-line version of the demos and parts list to be available to its sales team and customers, (o/k, maybe this is not a typical scenario, but it does demonstrate the usage).
    When developing the 'custom' html 5' enabled page I would require the cache manifest to include all necessary javascript/images/videos that would be required for the particular auto manufacturer to be available off-line, and compiling the list must be done at present by hand making it subject to possible errors.
    As for the database, (manufacturer specific) this must also be available off-line and updateable by the sales person and customer, as they are not always on-line and no hard-copys of material will be produced, (except when printed by the mechanic).
    My solution for me regarding the cache manifest would possibly be a dialogue in dreamweaver that would show all resources associated with the auto manufacturers model type used in the html site. I have used namespaces, (or some form of identifier) for general and model specific javascript, and a model identifying code for images and videos. The dialogue would then allow me to filter the resources required using the namespaces and identifier and include them in the list as required, possibly in much the same way that items are moved from a general list to a more specific list when creating the 'favourites' toolbar in dreamweaver.
    The database is on first appearance much simpler, as I would simply download the database using the motor_id as a filter, (yes Scott, you can see where I am going with this ) for those who cannot this would be wrong. You have correctly seen the problem with doing this, but I will explain for those who have not. The sales person and the customer would not see any of the images or videos that have references stored in the database, as these are just references and not the actual images/videos, yes one could use 'BLOB' for storing the items but this is not in my experience a reliable method. What is required is some form of method that would also download these items and place them into the required file position for off-line viewing, (which is what the cache manifest would do).
    So I would also require the possibility to add dynamically to the cache manifest from an sql database at the same time as the 'save for off-line' option is generated, (I have experimented with doing this in a similar manner that xml is created from an sql database).
    That's it for the html 5.
    Accessibility:
    For checking I use the firefox accessibility extension and total validator extension first, then the WAVE evaluation tool.
    But for Dreamweaver I would like to see the inclusion of the ARIA options as standard, especially when developing 'rich-internet-applications' particularly the aria-live and role options. I often find it interesting in discussions about html 5 where it is seen by many as a 'new' mark-up' language for the web, but rarely seen in the context of helping in accessibility when used correctly. Even the html 5 spec contains a section on using the new mark-up as part of accessibility and how the ARIA roles should be applied, (see - http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#annotation s-for-assistive-technology-products-%28aria%29).
    The inclusion of an extra live-view option in dreamweaver that render the page in 'screen reader' mode would also be a possible accessibility checking help. This could be done by simply turning off the background-images 'on-mass' and rendering any items as they would be seen by a screen reader. As most screen readers do now parse JavaScript and css, it would illustrate the problems of using such techniques as light-boxes without using the aria-live role to tell users that the light-box in now the focus of the page.
    For anyone who has stayed with this post, my sincere thanks, and any comments on the content would be welcome.
    Paula Z

  • How to suppress the html comment at start of output

    Hi,
    Does anyone know how to suppress the html comment that ITS inserts at the beginning of the response content.
    i.e.:
    <!--
    This page was created by the
    SAP Internet Transaction Server (ITS, Version 6100.1030.61.1891, Build 610.611891, Virtual Server SY1, WGate-AGate Host aauwsd00, WGate-Instance SY1)
    Template:       znc_xworktime/99/xml.html  -->
    This appears to be causing havoc with the applet's XML parser...
    org.jdom.input.JDOMParseException: Error on line 8: XML declaration may only begin entities.
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:468)
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
         at com.alcatel.ontap.applets.timesheet.TimesheetTableLoader.run(TimesheetTableLoader.java:75)
    Caused by: org.xml.sax.SAXParseException: XML declaration may only begin entities.
         at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
         at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3364)
         at org.apache.crimson.parser.Parser2.maybePI(Parser2.java:1140)
         at org.apache.crimson.parser.Parser2.maybeMisc(Parser2.java:1266)
         at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:654)
         at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
         at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
         ... 2 more

    Check out OSS Note No.747818
    You can use the ~no_its_header parameter to deactivate the default       
    header that is generated. As soon as this parameter contains any value,  
    header generation is suppressed. In ITS 6.20, you can set the parameter  
    with the AdminTool. You will find the relevant switch under              
    Security-General.                                                        
    If the ITS is integrated into the WebAS (SAP Netweaver 04 and higher),   
    you must maintain the parameter in the ICF service. Note that you have   
    to maintain the parameter individually for each service.                 
    Regards
    Raja

  • Is there any difference between "jsp:useBean" and "scriptlet" ?

    A few days ago, I asked similar question. But I didn't get the answer I wanted.
    I want to know the differnce between <jsp:useBean../> and <% .. %>(scriptlet).
    I tested in three environments(Oracle Jserv, OC4J, and Apache Tomcat).
    In Oracle Jserv and OC4J, a problem occured. But, Apache Tomcat does not occur a problem.
    For example,
    1) TestClass.java (Bean)
    public class TestClass {
    private String txt;
    public class TestClass {
    txt = "Test"; ----- (g
    public String getTxt() {
    return txt;
    2) test.jsp
    <html><body>
    <% TestClass test = new TestClass(); %> ---(h
    <%= test.getTxt() %>
    </body></html>
    Assume that I visit "http://localhost:8888/test.jsp".
    In Tomcat, if I change "Test"(number(g) to "Test1" and compile the browser shows the change.
    But Oracle Jserv and OC4J does not do that. They also show the old String.
    So, I changed <% TestClass test = new TestClass(); %>(number(h) to <jsp:useBean id="test" class="TestClass" />. That is, I changed "Scriptlet" to "JSP useBean Tag".
    Then, Oracle Jserv and OC4J also show the changes.
    To conclude, is there any difference between "JSP useBean Tag" and "Scriptlet"?
    Can't I use a scriptlet (to make a class) in Oracle Servlet Engine?
    Thanks.

    It could be as simple as the JSP not recompiling between java recompiles - ie, it compiles in the link to the old class.
    Try changing the JSP file (add and delete a space) after you change the java code, and then see what happens.
    Jonny
    null

  • Inserting HTML comments from the Insert menu

    So I understand that the insert menu has been changed in CS6 and then again in CC  (Dreamweaver 12.2). 
    http://helpx.adobe.com/dreamweaver/using/changes-insert-options-creative-cloud.html
    I am using DW CC.   I want to insert HTML comments quickly in a bunch of different locations in my page code.  Is there a way to do that?
    If this must now be done by hand I would like to know why.  The reason for the changes is explained as removing support for deprecated elements, but HTML comments are not deprecated in HTML 5.
    http://www.w3.org/html/wg/drafts/html/master/syntax.html#comments

    There is another option. Select the block of the code and choose the comment option as per your requirement. See image below.

Maybe you are looking for

  • Mass price change

    hi , Is there any Std T.code to do Mass price Change of Materials ? regards Mike

  • Tethered Shooting with Nikon D7000 - when?

    I was quite surprised (as, it seems, have others) to discover that tethered shooting is not yet supported with the Nikon D7000 in the latest Lightroom 3.3 release. Has Adobe made any statements regarding the availability of this feature? Does anyone

  • New Airport Express: Stream from iOS5 devices to multiple AEs?

    Hi all, is it possible to stream music from iOS5 devices (iPhone4/iPad3/Apple TV 3) to multiple (new) Airport Express devices? Thanks.

  • RE-Install Tiger with no disc drive.

    Here's my problem: Old MacBook 1.83 GHz with a disc drive that seems dysfunctional. It actually did not read any CDs or DVDs, and was recently replaced by a third party warranty company. When I received the computer after the warranty work, it read C

  • Select exception!!!!

    hi anyone would help me ?? PreparedStatement select_stm =con.prepareStatement("select ISBN,B_nam,pub_hous from Book_inf where ?=?"); ~~~~~~~~~~~ I wonder if there's something wrong with this ?? select_stm.setString(1,chechby); select_stm.setString(2,