>From: Sergey <[EMAIL PROTECTED]> 
>
> Hello, 
> 
> I like your solution a lot. But I'm wondering if it going to be possible 
> express the following in outer HTML template. 
> 
> >< property="selectedContact.firstName" size="20" maxlength="30" 
> required="true" immediate="false"/> 
> 
> I've tried it and got error: 
> java.lang.RuntimeException: java.lang.IllegalArgumentException: Subsequent 
> characters of component identifier must be a letter, a digit, an underscore 
> ('_'), or a dash ('-')! But component identifier contains "." 
> org.apache.shale.clay.component.Clay.encodeBegin 
> (Clay.java:359) 
> org.apache.shale.clay.faces.ClayViewHandler.recursiveRender 
> (ClayViewHandler.java:402) 
> org.apache.shale.clay.faces.ClayViewHandler.renderView 
> (ClayViewHandler.java:345) 
> org.apache.shale.faces.ShaleViewHandler.renderView 
> (ShaleViewHandler.java:143) 
> 



The issue is that the property symbol "@property", is used as the component id.
The dot's are not valid for a property name.  You will want to only provide the
name of the bean property in the property symbol.  
Use the @managed-bean-name symbol to hold the backing bean name.


There are three layers of reuse in the recipe.  The first is the out template 
that 
you have above that includes a template passing in symbols.  The second layer 
is the html template called "/widgets.html".  This template binds to some
generic component definitions that are parameterized with symbols. 
Notice the value attribute of the "widgetsText" XML component def.   

Another interesting reuse feature is that you can change the properties
of the XML component definition and it will be applied to all uses
of the widgets.html template.

Outer template:
<tr jsfid="clay" clayJsfid="/widgets.html" label="First Name:"
        property="firstName" size="20" maxlength="30"
        required="true" immediate="false" managed-bean-name="selectedContact"/>

Html template: /widgets.html
<tr>
   <td><label jsfid="widgetsLabel">Mock Label:</label></td>
   <td><input jsfid="widgetsText" type="text"/></td>
   <td><span jsfid="widgetsMessage">Mock Message</span><td>
</tr>

xml component defs:
<component jsfid="widgetsLabel" extends="baseLabel"> 
   <attributes>
   <set name="value" value="@label" />  
   <set name="for"   value="@property" />
   </attributes>
</component>    
<component jsfid="widgetsText" extends="inputText" id="@property"> 
   <attributes>
      <set name="value" value="[EMAIL PROTECTED]@property}"/>  
   <set name="size" value="@size" />
   <set name="maxlength" value="@maxlength" />
   <set name="required" value="@required" />
   <set name="immediate" value="@immediate"/>
   </attributes>
</component>
<component jsfid="widgetsMessage" extends="baseMessage" > 
   <attributes>
      <set name="for" value="@property" />  
   </attributes>
</component>



Links to working examples in the Shale usecase application:
http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/symbols/inputTextWidget.html?rev=369652&view=log

http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/use-cases/src/web/symbols/businessPerson.html?view=markup


> Regards, 
> 
> Sergey 
> 

Gary

> 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
> 

Reply via email to