JSP Document HTML Output

Discussion in 'Java' started by johkar, Nov 4, 2006.

  1. johkar

    johkar Guest

    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
    johkar, Nov 4, 2006
    #1
    1. Advertising

  2. johkar wrote:
    > 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
    as <img>, check it here.. <http://validator.w3.org/>.

    >...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.
    Andrew Thompson, Nov 4, 2006
    #2
    1. Advertising

  3. johkar

    johkar Guest

    Andrew Thompson wrote:
    > johkar wrote:
    > > 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
    > as <img>, check it here.. <http://validator.w3.org/>.
    >
    > >...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.


    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
    johkar, Nov 4, 2006
    #3
    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. DigitalUncle
    Replies:
    0
    Views:
    876
    DigitalUncle
    Nov 2, 2004
  2. mike
    Replies:
    2
    Views:
    494
    Chris Smith
    Jan 14, 2005
  3. johkar

    HTML output of JSP document

    johkar, May 31, 2005, in forum: Java
    Replies:
    1
    Views:
    1,385
    John C. Bollinger
    Jun 6, 2005
  4. Replies:
    0
    Views:
    4,314
  5. Ralph Amissah
    Replies:
    0
    Views:
    175
    Ralph Amissah
    Nov 20, 2005
Loading...

Share This Page