I'm starting a Java project where the client has mandated the use of XHTML 1.0 Strict. JSF Facelets, being XHTML-based seemed a good option at first, but I've found that they cannot be made to produce XHTML Strict, and this is considered a very low priority issue by the community.
Are there other Java frameworks that 开发者_StackOverflow社区support rendering as XHTML Strict? What about the JSTL tag libraries?
I'll extend my comment a bit here. JSF is not a regular web-framework. It is a component-based web-framework. So are GWT, Vaadin, Echo and the likes. With them one cannot easily get around if they don't produce XHTML strict. (well, you can change the Component/Renderer in JSF, if you like)
On the other hand, frameworks like Spring-MVC, Struts, Grails, etc. are action-based web-frameworks. They do not have components as intrinsic parts. Yes, they do provide convenient tag libraries, but you can go without them, if they happen to be unable to produce strict xhtml. For example you can use <form:input>
, but you can also use <input type="text" />
and just set the proper name
and value
.
Most of the action-based frameworks rely on JSTL for their flow-control in the view (JSP). So no scriptlets. But JSTL itself does not render any markup. So you can use JSTL + your hand-written markup to generate XHTML strict.
The tag libraries that will be used is a different story. For example if you want a calendar, you can use a taglib, and it might not render proper xhtml. But you can also a jQuery calendar - the difference won't be huge for an action-based framework.
That said, I have experience with Spring-MVC and Grails, and you can use them - they allow fine-grained control on the generated markup.
The documentation for Spring Web MVC 2.0.x indicate that the associated tag libraries produce HTML4.0.1/XHTML1.0 valid markup. That might be a good starting point, as I'd expect 2.5 and probably even 3.0 to support this as well.
http://static.springsource.org/spring/docs/2.0.x/reference/mvc.html
精彩评论