JSP Document HTML Output

J

johkar

JSP documents require XML syntax for all HTML elements (<img />). By
default, the elements are outputted with XHTML syntax, is there a way
to tell the JSP container that you want HTML 4 syntax (<img>) instead
of the XHTML version?

John
 
A

Andrew Thompson

johkar said:
JSP documents require XML syntax for all HTML elements (<img />). By
default, the elements are outputted with XHTML syntax, is there a way
to tell the JSP container that you want HTML 4 syntax (<img>)

As I understand it, <img/> is equally valid in HTML 4.01
...instead of the XHTML version?

As someone looking to take HTML 4.01 through XHTML
and on to XML, I am curious as to why you are so keen to
go in the exact opposite direction. Is this all for saving
a few bytes?

Andrew T.
 
J

johkar

Andrew said:
As I understand it, <img/> is equally valid in HTML 4.01


As someone looking to take HTML 4.01 through XHTML
and on to XML, I am curious as to why you are so keen to
go in the exact opposite direction. Is this all for saving
a few bytes?

Andrew T.

Thanks for the reply Andrew.

HTML 4.01 transitional allows XML style tags for img, input, br and the
like, however HTML 4.01 Strict does not. I tend to prefer XHTML too,
but here is my situation. I have a custom tag library which outputs
the wrapper HTML for applications (top banner, navigation, left and
right columns and footer. Some of the tags (meta, img, link) need to
be outputted the appropriate way in order to validate. When HTML 4.01
and XHTML are passed in as a tag attribute value by the developer
(strict or transitional), either I need to do something in the tag
class...or maybe it can be handled somewhere else. My question is if
there is a way to control this in the JSP...like the jsp:eek:utput tag or
something. This will be used across the company and it needs to be
flexible for the various docttypes, not just my preference.

In addition, the developer's code would need to output appropriately
too. Maybe the answer is to not use JSP documents if not declaring
XHTML.

John
 

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
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top