Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java web framework that can reliably produce XHTML 1.0 Strict?

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 support rendering as XHTML Strict? What about the JSTL tag libraries?

like image 272
Michael Borgwardt Avatar asked Dec 07 '10 15:12

Michael Borgwardt


People also ask

What is XHTML 1.0 strict?

XHTML 1.0 Strict is the XML equivalent to strict HTML 4.01, and includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification. As of November 2015, XHTML 1.0 Strict is the document type used for the homepage of the website of the World Wide Web Consortium.

Is XHTML strict?

There is no strict rules on structure when using HTML, but you should follow strict structure rules in XHTML. If you are using HTML, then you can use upper case and lower case for tags and attributes However, in XHTML, tags and attributes are strictly lower case.

Why XHTML is stricter than HTML?

XHTML was developed to make HTML more extensible and flexible to work with other data formats (such as XML). In addition, browsers ignore errors in HTML pages, and try to display the website even if it has some errors in the markup. So XHTML comes with a much stricter error handling.

What is XHTML format?

XHTML is a format, which is a collection of different document types and modules that mimic, categorize, and extend HTML 4. The files in XHTML are XML based, and aimed to work with the user agents based on XML. XHTML files are XML conforming. Standard XML tools are used to view, edit and validated XHTML files.


2 Answers

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.

like image 198
Bozho Avatar answered Sep 20 '22 14:09

Bozho


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

like image 22
Mike Yockey Avatar answered Sep 20 '22 14:09

Mike Yockey