views:

60

answers:

2

Hi folks,

I'm writing a web application using Spring MVC. Although Spring MVC comes with a couple of tag libraries, they are not rich as Struts' counterpart. What I miss most is <html:xhtml>.

Those of you using Spring MVC, what third-party tag libraries do you guys use?

Thanks!

Edit: More specifically, I would like to auto-generate the following using a custom tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
+1  A: 

You might want to try the spring's form taglib

"<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>"

it is html 4.01 and XHTML1.0 compliant.

Harsha
+2  A: 

If all you want to do is generate that fragment, then what's wrong with <jsp:include>, or a simple tagfile, e.g.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<jsp:doBody>
</html>

Stick that in /WEB-INF/tags/xhtml.tag, and you're done, e.g.

<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>

<tags:xhtml>
   // Rest of content in here
</tags:xhtml>
skaffman
It would be kind of awkward to write something like <jsp:include path="html" /> and </html>. It would be more readable to write <html:html> and </html:html>.
Tom Tucker
@Tom: see edit .
skaffman
Wicked. Thanks.
Tom Tucker
+1 for promoting tag files, although the struts xhtml tag also sets a flag that makes all struts tags render in xml mode, ie using `/>` for empty elements.
Jörn Horstmann