Search code examples
htmltagsxhtmlstrutsw3c-validation

HTML to XHTML conversion without HTML tag


Problem:

My project is using Struts Framework, specifically the html:button tag explained here on Struts Apache Documentation

The issue is the html:button tag turns into

<input>

, failing w3c compliance tests. The tag needs to turn into

<input/>

Reason:

I use an html tag specifying xhtml, which is in a template file used in all my other files. All the other files are not converted to xhtml though since the tag is in the template file. Is there a way to make all the other files xhtml, without using an html tag?


Solution

  • The solution to this problem is to add

    <html:xhtml/>
    

    after all the taglib tags on each jsp page

    Example of taglib tag:

    <%@ taglib uri="/taglib/htmlstrut" prefix="html"%>