struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Gary VanMatre)
Subject Re: [shale] Extending components with new attributes
Date Tue, 07 Mar 2006 00:21:22 GMT

>From: Richard Wallace <> 
> Hello, 
> I'd like to extend the inputSecret component and give the new component 
> an added attribute. Basically, what I want to do is create a component 
> that has the tomahawk equal validator attached to it. So, what I've got 
> now is: 
>  <component jsfid="t:validateEqual" 
>    <attributes>
>      <set name="for" bindingType="Early" />
>    </attributes>
>  </component>
>  <component jsfid="inputPasswordVerification" extends="inputSecret">
>    <validator jsfid="t:validateEqual">
>      <attributes>
>          <set name="for" value="password"/>
>      </attributes>
>    </validator>
>  </component>
> What I'd like to be able to do is replace the attribute for "for" with 
> something more like "@for" or something so that I can use the component 
> like: 
><input type="password" jsfid="inputSecret" id="password" />
><input type="password" jsfid="inputPasswordVerification" for="password" />
> Can I add an attribute like that in clay? That would be very cool. 

You should totally be able to do this using Clay.  There is a very similar example in the
symbols (symbols/page3.html) usecases.  There's one more layer than you need in your example.

Includes an html template from the class path passing symbols label, property, size, maxlenght,
required and immediate.
    <tr jsfid="classpath*:org/apache/shale/usecases/symbols/inputTextWidget.html" label="First
        property="firstName" size="20" maxlength="30" 
        required="true" immediate="false"/>

The "org/apache/shale/usecases/symbols/inputTextWidget.html" template is used for layout.
 It's bound to some base XML config data.
   <td><label jsfid="widgetsLabel">Mock Label:</label></td>
   <td><input jsfid="widgetsText" type="text"/></td>
   <td><span jsfid="widgetsMessage">Mock Message</span><td>

The base config definitions are defined in "WEB-INF/clay-symbols-config.xml"
        <component jsfid="widgetsLabel" extends="baseLabel"> 
     <set name="value" value="@label" />  
     <set name="for"   value="@property" />
 <component jsfid="widgetsText" extends="inputText" id="@property"> 
        <set name="value" value="#{@managed-bean-name.@property}"/>  
     <set name="size" value="@size" />
     <set name="maxlength" value="@maxlength" />
     <set name="required" value="@required" />
     <set name="immediate" value="@immediate"/>
 <component jsfid="widgetsMessage" extends="baseMessage" > 
        <set name="for" value="@property" />  

> Thanks, 
> Rich 


> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: 
> For additional commands, e-mail: 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message