jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Struts input tags and xhtml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts input tags and xhtml" Watch "Struts input tags and xhtml" New topic

Struts input tags and xhtml

Ken Pelletier
Ranch Hand

Joined: Aug 01, 2002
Posts: 54
I am using Struts 1.1 final, and am having trouble getting valid xhtml to be rendered for the various input taglibs.
All of my pages use the following Struts html tag:

This Struts html tag does properly render the html tag markup itself, complete with xmlns, lang and xml:lang attributes.
However, the input tags inside these pages are not rendered with the required closing tag:

Results in this:

Instead of the required:

Note the closing end tag as required by xhtml.
I am using tiles, and the outer layout for all pages is where the Struts html tag resides - I'm not sure if this is somehow causing embedded tiles with input tags to fail to recognize that they are inside of an xhtml page.
Any posts about this problem I have seen state that Struts 1.1 only requires the 'xhtml="true"' attribute on the html tag in order to solve this, but this has not been my experience.
Ken Pelletier
Ranch Hand

Joined: Aug 01, 2002
Posts: 54
As is often the case, I discovered the answer only after posting.
So, for those who bump into a similar problem with xhtml rendering by Struts, it is indeed the case that included pages do NOT inherit the rendering style of their including page.
[CODE]<html:html xhtml="true">...</html:html>[CODE]
... will only affect the rendering of the outer-most page - the page in which it appears.
Each included fragment that itself uses Struts tags to render markup will have to indicate that they are to be rendered as xhtml.
If you use any method ( Tiles, <jsp:include../> ... ) to include a jsp page that also uses Struts tags, that included page must have the empty xhtml tag in it:
[CODE] <html:xhtml/> [CODE]
I agree. Here's the link: http://aspose.com/file-tools
subject: Struts input tags and xhtml
It's not a secret anymore!