Tomcat and struts: expanding empty XML tags in XHTML

Y

yzzzzz

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!)
 
R

Ryan Stewart

yzzzzz said:
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?
 
Y

yzzzzz

Ryan said:
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).
 
W

Wendy S

yzzzzz said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top