I use struts-html to generate forms fields.
For example:
<%@ taglib prefix='html' uri='/WEB-INF/taglibs/struts-html.tld' %> <html:text property='email' styleId='email' size='44'/>
generates:
<input type='text' name='email' size='44' value='' id='email'>
As shown above the generated input tag is not closed. This causes my html to be not valid.
struts-html.tld includes:
<tlibversion>1.2</tlibversion> <jspversion>1.1</jspversion> <shortname>html</shortname> <uri>http://struts.apache.org/tags-html</uri>
Does anyone knows why is the generated input not closed? Is there a newer version? Where can it be downloaded?
I tried using:
<html:html xhtml='true'>
which renders as:
<html xmlns='http://www.w3.org/1999/xhtml' lang='en-US' xml:lang='en-US'>
However, my input tags keep rendering unclosed.
Solution:
Use the tag:
<html:xhtml/>
Note: If you use Tiles, as I do, use it directly inside your included jsp. It is not inherited from your base template file.
Note: Within xhtml mode you can not use sytleId inside a html:form tag. It is not a problem since the id property is automatically generated to store your bean’s name.
Can you not just use
<html:xhtml/>?Alternatively you could use
<html:html xhtml='true'>.