Hi Simon,
Hardcoded subview id does not work when I need to include components in the
loop. In the code piece I put on the original email I need to include
multiple screen section containers handled by the same tile layout. Tile
inclusion needs to be wrapped in subview. As number of components is not
known in advance I cannot hardwire subview Id. 

Option 1 does not work because it results in multiple containers with same
id.

>>The TLD is correct: the JSF spec declares the "id" attribute of the 
>>f:subview component to be mandatory. As far as I know, id is optional 
>>for all other components.

OK, but nobody says that Id has to be *coded* and cannot be generated by
implementation. TLD also says that id will be generated if omitted. And it
does get generated properly. That's why I say that TLD needs to be
corrected.


>>No component allows EL expressions for ids; if specified it *must* be a 
>>literal string.
This sounds rather 'kludgy' but spec is a spec I guess.

Basically it all boils down to lack of "include" tag and loop processing
facilities in JSF itself.

Igor


-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 13, 2005 6:12 PM
To: MyFaces Discussion
Subject: Re: myfaces-core.tld - subview tag

Hi Igor,


Igor Marakov wrote:
> There seems to be a problem while trying to use automatically generated 
> subview id  in myfaces1.1.1
> 
> According to TLD file ID attribute is created automatically when 
> omitted. At the same time ID attribute is defined as
> 
> <required>true</required>
> 
> This causes compile time error when id is omitted on the <f:subview> tag.
> 
>  
> 
> Here is the situation:
> 
>    1. If I hardwire subview id on the inner subview - only the last row
>       component shows up on the screen
>    2. If I put EL expression into the id - it does not get interpreted
>       and I get error saying that ID must not start with #
>    3. If I put JSP expression into the id - like
>       id="row<=%String.valueOf(section_num)%> it does not get
>       interpreted either resulting in the same error as #2
>    4. If I don't use ID attribute - I get compile time error.
>    5. If I "doctor" tld file changing ID attribute description from
>       <required>true</required> to <required>false</required> -
>       everything works beautifully and ID does get generated properly.
> 
>  
> 
> Am I missing something here or does TLD file need to be corrected?
> 

The TLD is correct: the JSF spec declares the "id" attribute of the 
f:subview component to be mandatory. As far as I know, id is optional 
for all other components.

No component allows EL expressions for ids; if specified it *must* be a 
literal string. JSF components need to have the same id over their 
lifetimes; dynamic ids are a really bad idea for several reasons.

JSP expressions don't get evaluated in JSF tag attributes. This might 
change in JSF 1.2, but even then I suspect it will be forbidden within 
the "id" attribute.

So you'll need to look more deeply into why your option (1) doesn't 
work. That should be the correct approach.

Regards,

Simon


Reply via email to