>From: "Wendy Smoak" <[EMAIL PROTECTED]> 
>
> On 9/24/06, Gary VanMatre wrote: 
> 
> > Hey Wendy, this looks like the classic JSF 1.1 problem with JSP that will 
> > be fixed in JSF 1.2. 
> 
> That's what I thought. :) 
> 
> > It's also a good practice to wrap an included fragments in a subview tag. 
> > The 
> subview is a naming container that will allow the same fragment containing 
> input 
> widgets to be included several times in the same page. 
> > 
> 
> This came up recently on [EMAIL PROTECTED] [1] and Dick Starr reported that 
> the was working with or without a subview tag. I'm not 
> sure how that differs from though. 
> 
> I doubt he's including the header text more than once... exactly when 
> is the subview tag necessary, and what does it do? 
> 
Let's say you had two address jsp fragments for street and mailing address.  
Both fragments contain the same widgets just bound to different properties in 
the backing bean.  You want to include both into the same form.  
streetAddress.jsp
<h:inputText id="address1" value="#{streetAddress.address1}"/>
...
mailingAddress.jsp
<h:inputText id="address1" value="#{mailingAddress.address1}"/>
The html input elements will be named using the id attribute of the "inputText" 
tag.  Without a subview tag, there would be two html elements with the same 
name.  The subview component is a naming container that will force the id of 
the subview into the id of all contained elements.  This is called the 
components client id.  The h:form component is also a naming container.
If each included jsp was nested in a subview in the same form, the id and name 
of the two input widgets might looks something like this:
name="form1:streetSubview:address1"
name="form1:mailingSubview:address1"
 
You might say, big deal.  Just name the widgets in address fragment uniquely.  
Well, if you use Clay, you wouldn't need to create two address templates.  You 
can use Clay's symbols to reuse the same template by changing the value binding 
expression.
<h:inputText id="address1" value="[EMAIL PROTECTED]"/>
The symbol "@managed-bean-name" could be substitued with "streetAddress" or 
"mailingAddress".
Gary




> [1] 
> http://www.nabble.com/Shale-1.0.3-and-Tiles-Question---Tag-Question-t2204571.htm
>  
> l#a6288731 
> 
> Thanks, 
> Wendy 

Reply via email to