Apache tiles converts open tag and close tag with no content to an empty tag.
For example <script src="some.js"></script>
will be written as <script src="some.js"/>
, which breaks my HTML.
How to prevent this behaviour?
Apache tiles converts open tag and close tag with no content to an empty tag.
For example <script src="some.js"></script>
will be written as <script src="some.js"/>
, which breaks my HTML.
How to prevent this behaviour?
I don't suppose this works?
<script src="some.js" type="text/javascript"></script>
or
<script src="some.js" type="text/javascript"> </script>
Not too sure the above would even solve the validation issue, even if it did work
Does it really "break your HTML"? Did you check with a validator, like validator.w3.org? You are describing perfectly valid XML. To which DTD should your HTML conform? Personally, I would aim for XHTML, where this is not a problem.
Edit: Is your server delivering text/html
or application/xhtml+xml
? It seems some browser will not be too happy with XHTML delivered as text/html.
You need to put some content in between the script start and end tags, enough to stop Tiles from collapsing it down. Try some white space, or a line break, or even a
. If Tiles keeps doing it, you need to introduce some content in there that it won't collapse, perhaps a javascript comment?