struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sathish Kumar <sathishkumar.thiyagara...@gmail.com>
Subject Reg: XHTML Theme's Control Footer Reference
Date Wed, 24 Jun 2009 12:05:17 GMT
Hi,

In struts 2 applications, we used to cover the HTML controls using themes (
like text input, combo box etc ), This will add some *wrappers  *around the
controls that will be used to display label, validation messages etc..

In the XHTML theme ( Folder: template/xhtml ) these wrappers will be with
some <tr> & <td> elements. For Eg.,

*[@s.textfield name="firstName" key="First Name" cssClass="textbox"/]*
>

will be rendered as

 *<tr>
>      <td class="tdLabel"><label for="firstName" class="label">First
> Name:</label></td>
>      <td>*
>      <input type="text" name="firstName" value="" id="firstName"
> class="textbox"/>
>     * **</td>**
>  </tr>*
>

At times, Our Applications might need to make wrappers as per their own UI.
For Eg. Instead of *<td>*, We may use *<div> *or *<p>* etc as below

> * <p>
>  <label>firstName</label>*
> <input type="text" name="firstName" value="" id="firstName"
> class="textbox"/>
> * </p> *
>

While looking at the Source of Text Tag Template (*xmtml/text.tag*),

 <#include "/${parameters.templateDir}*/${parameters.theme}/*controlheader.ftl"
> />
>  <#include "/${parameters.templateDir}/simple/text.ftl" />
>  <#include "/${parameters.templateDir}*/xhtml/*controlfooter.ftl" />
>

It contains 3 templates ( Header, Footer and the original htlm tag from
simple theme)

Consider, we create a new theme just to change these wrappers ( Header and
Footer ) by extending XHTML theme., As of Now, For this, We *need to modify
each individual control's  templates(text.ftl, combo.ftl etc)* file. The
reason is that, the *footer component theme is hard coded as “xhtml”*. It
will be good if we change the *xhtml/text.ftl* to

 *<#include
> "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" />
> <#include "/${parameters.templateDir}/simple/text.ftl" />
> <#include "/${parameters.templateDir}/${parameters.theme}//controlfooter.ftl"
> />*
>


So that, it will be easy to *modify all the control wrappers just by
modifying controlheader.ftl & controlfooter.ftl*.

Please share your views about the same.

 Regards,
Sathish Kumar T

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message