Tomcat and struts: expanding empty XML tags in XHTML

Discussion in 'Java' started by yzzzzz, Jan 1, 2005.

  1. yzzzzz

    yzzzzz Guest

    Hi,

    I am using Tomcat 5.5 and struts 1.2.4, everything in XHTML.
    Here is my problem:

    If file.jspx contains
    <script type="text/javascript" src="file.js"></script>
    after it is parsed by Tomcat, the browser receives
    <script type="text/javascript" src="file.js"/>

    This is correct, and Firefox understands it, but it is not backwards
    compatible with HTML, so MSIE doesn't. I just get a blank page with MSIE.

    Is there any solution to this problem? (Maybe a filter that could change
    <script/> back to <script></script> or something)

    Thank you.

    (PS. no I'm not going back to serving HTML4!)
     
    yzzzzz, Jan 1, 2005
    #1
    1. Advertising

  2. yzzzzz

    Ryan Stewart Guest

    "yzzzzz" <> wrote in message
    news:41d601a3$0$2569$...
    > Hi,
    >
    > I am using Tomcat 5.5 and struts 1.2.4, everything in XHTML.
    > Here is my problem:
    >
    > If file.jspx contains
    > <script type="text/javascript" src="file.js"></script>
    > after it is parsed by Tomcat, the browser receives
    > <script type="text/javascript" src="file.js"/>
    >

    I haven't seen this one before. Are you *sure* it goes in Tomcat correctly
    and comes out changed? Do you have any thoughts on what might be causing it?
     
    Ryan Stewart, Jan 1, 2005
    #2
    1. Advertising

  3. yzzzzz

    yzzzzz Guest

    Ryan Stewart wrote:
    > "yzzzzz" <> wrote in message
    > news:41d601a3$0$2569$...
    >
    >>Hi,
    >>
    >>I am using Tomcat 5.5 and struts 1.2.4, everything in XHTML.
    >>Here is my problem:
    >>
    >>If file.jspx contains
    >><script type="text/javascript" src="file.js"></script>
    >>after it is parsed by Tomcat, the browser receives
    >><script type="text/javascript" src="file.js"/>
    >>

    > I haven't seen this one before. Are you *sure* it goes in Tomcat correctly
    > and comes out changed? Do you have any thoughts on what might be causing it?


    I don't know if this is normal, but all my jspx files are parsed and
    come out on a single line (when I view source). I suppose the jspx is
    parsed as XML (whitespace being ignored, as with any XML), and the
    canonical form in the XML parser is then interpreted (doing stuff with
    elements in the <html:> and <c:> namespaces) and then it regenerates the
    output, so it is not surprising I loose the code's "layout", the HTML
    comments, and empty elements are in their short form.

    I can give you config details if you like.

    BTW I have the same problem with empty <td>s becoming <td/> instead of
    <td></td> (but this is less important, as </td> is not required in HTML4).
     
    yzzzzz, Jan 1, 2005
    #3
  4. yzzzzz

    Wendy S Guest

    "yzzzzz" <> wrote:
    > Is there any solution to this problem? (Maybe a filter that could change
    > <script/> back to <script></script> or something)


    What happens if you put something in between the script tags, a <!--
    comment --> maybe?

    --
    Wendy S
     
    Wendy S, Jan 28, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. A. Brinkmann
    Replies:
    2
    Views:
    1,114
    A. Brinkmann
    Apr 16, 2004
  2. Aleksandar Matijaca
    Replies:
    2
    Views:
    8,467
    Aleksandar Matijaca
    Sep 19, 2004
  3. Greg Smith
    Replies:
    35
    Views:
    3,223
    Alex Kay
    Oct 24, 2004
  4. John M
    Replies:
    1
    Views:
    786
  5. Tim
    Replies:
    2
    Views:
    113
Loading...

Share This Page