You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ted Husted <hu...@apache.org> on 2006/09/15 12:08:48 UTC

Re: [Struts 2] and tags adding unwanted HTML code

Yes, if you prefer to code your own markup, then you can use the
simple theme. To use the simple theme throughout an application, add
this line to the struts.properties file.

* struts.ui.theme=simple

The struts.properties file can be placed under classes, next to the
struts.xml file.

The themes are designed to reduce the amount of markup we need to code
into each page. The general idea is that we can create a form just by
specifying the fields, and let the theme generate the HTML markup for
us. (Like using an advanced stylesheet.) The default theme has handy
features like automatically displaying validation errors above each
field, with any extra work on our part.

Here's the source code for the example, relying on the theme to
generate the HTML markup.

> <s:form action="userConnect">
>   <s:textfield label="Connectez vous:"  name="login"  size="20" />
>   <s:password label="mot de passe : " name="password" id="password" size="20" />
>   <s:submit type="image" id="imgSubmit" src="www/tortue_contour_noire_20_16.jpg" />
>   </s:form>

Note that the Struts 2 tags include new attributes, like "label". The
XHTML (and AJAX) themes will automatically inject a label tag into the
form.

Of course, you can always use the simple theme and inject all the
markup by hand, as we do in Struts 1.

The themes and individual tags can also be extended, if need be, to
meet any specific needs of an application.

* http://cwiki.apache.org/WW/themes-and-templates.html

-- HTH, Ted.
* http://www.husted.com/struts/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org