You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sathish Kumar <sa...@gmail.com> on 2009/06/24 14:05:17 UTC

Reg: XHTML Theme's Control Footer Reference

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

Re: Reg: XHTML Theme's Control Footer Reference

Posted by Dave Newton <ne...@yahoo.com>.
Please ask this question on the struts-user mailing list. The struts-dev 
list is for the development of Struts itself.

http://struts.apache.org/mail.html

Thanks,
Dave

Sathish Kumar wrote:
> 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
> 

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