hello,

example:
use [1] to generate a demo application with facelets (option 2).

change the id of the panelGrid
from
<h:panelGrid id="grid" columns="2">
to
<h:panelGrid id="#{helloWorldBacking.myId}" columns="2">
and add
    public String getMyId() {
        return "myID";
    }
to the HelloWorldBacking class.

have a look at the rendered html and you will find:
<table id="form:myID">

regards,
gerhard

[1] http://wiki.apache.org/myfaces/MyFaces_Archetypes_for_Maven



2008/11/26 Pierandrea Cercato <[EMAIL PROTECTED]>

> I tried first  (see the first post)  without any facelets component but was
> not working. Then as suggested i created a facelts component but i was not
> successful anyway. Is there anyway to pass a dynamic id to a component?
>
> Please any idea?
>
> 2008/11/26 Gerhard Petracek <[EMAIL PROTECTED]>
>
>> hello,
>>
>> just try it without a custom component.
>> detailed information about facelets are available at [1]
>>
>> regards,
>> gerhard
>>
>> [1] https://facelets.dev.java.net/nonav/docs/dev/docbook.html
>>
>>
>>
>>
>> 2008/11/26 Pierandrea Cercato <[EMAIL PROTECTED]>
>>
>>> I've tried to define a custom coponent:
>>>
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>>>
>>> <html xmlns="http://www.w3.org/1999/xhtml";
>>>
>>>       xmlns:ui="http://java.sun.com/jsf/facelets";
>>>
>>>       xmlns:h="http://java.sun.com/jsf/html";
>>>
>>>       xmlns:f="http://java.sun.com/jsf/core";>
>>>
>>> <ui:composition>
>>>
>>>       <h:outputText value="#{myValue}" id="_#{myId}" />
>>>
>>> </ui:composition>
>>>
>>> </html>
>>>
>>> and i call it from another page
>>>
>>> <a:myOutputText myValue="#{translation.countryTranslation}"
>>> myId="#{translation.label}"/>
>>>
>>>
>>>
>>> but is not working...
>>>
>>>
>>>
>>>
>>>
>>> 2008/11/26 Gerhard Petracek <[EMAIL PROTECTED]>
>>>
>>> hello,
>>>>
>>>> with *facelets* you can use it as you expect it - e.g.:
>>>> <h:outputText id="#{myBean.myId}" .../>
>>>>
>>>> (matthias just explained it with a custom facelets component. in such a
>>>> case dynamic ids are required for some use-cases.)
>>>>
>>>> regards,
>>>> gerhard
>>>>
>>>>
>>>>
>>>> 2008/11/26 Pierandrea Cercato <[EMAIL PROTECTED]>
>>>>
>>>> Sorry but i dont get it. How is possible to pass a dynamic id with
>>>>> facelets.
>>>>>
>>>>>
>>>>> 2008/11/26 jhomuth <[EMAIL PROTECTED]>
>>>>>
>>>>>> Thx to all
>>>>>>
>>>>>>
>>>>>>
>>>>>> Matthias Wessendorf wrote:
>>>>>>
>>>>>>> On Wed, Nov 26, 2008 at 10:36 AM, Gerhard Petracek
>>>>>>> <[EMAIL PROTECTED]> wrote:
>>>>>>>
>>>>>>>
>>>>>>>> hello,
>>>>>>>>
>>>>>>>> you should also get the message:
>>>>>>>> "According to TLD or attribute directive in tag file, attribute id
>>>>>>>> does not
>>>>>>>> accept any expressions"
>>>>>>>>
>>>>>>>> solution:
>>>>>>>> you have to use facelets for dynamic id's.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> true, b/c that evaluates it internally as a string, eg:
>>>>>>>
>>>>>>> <my:coolThing componentId="#{blah}" ... />
>>>>>>>
>>>>>>> where the XHTML template would use
>>>>>>>
>>>>>>> <h:inputText id="#{componentId}" ...>
>>>>>>>
>>>>>>> #{componentId} is the VALUE of the (custom) attribute "componentId"
>>>>>>> on
>>>>>>> your component (my:coolThing)
>>>>>>>
>>>>>>> -Matthias
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> regards,
>>>>>>>> gerhard
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 2008/11/26 jhomuth <[EMAIL PROTECTED]>
>>>>>>>>
>>>>>>>>
>>>>>>>>> Hello List,
>>>>>>>>>
>>>>>>>>> it's strange, I wanted to ask the same question at the same moment.
>>>>>>>>> I also
>>>>>>>>> try to set the id from a controller value via EL. But the EL ist
>>>>>>>>> not treated
>>>>>>>>> like EL but rather than a String, because I always get the message
>>>>>>>>>
>>>>>>>>> "java.lang.IllegalArgumentException: component identifier's first
>>>>>>>>> character must be a letter or an underscore ('_')! But it is "#"
>>>>>>>>>
>>>>>>>>> That's why I quess the Expression (<tom:selectManyListbox
>>>>>>>>> id="#{TargetSystemConfigurationController.availableListID}"
>>>>>>>>> binding="#...)
>>>>>>>>> will be treated like a string.
>>>>>>>>>
>>>>>>>>> Is there any solution for this.
>>>>>>>>>
>>>>>>>>> Johannes
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [EMAIL PROTECTED] wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Good morning,
>>>>>>>>>>
>>>>>>>>>> I have a datatable wich use a list of simple object. When i use an
>>>>>>>>>> outputtext inside the table like this:
>>>>>>>>>>
>>>>>>>>>> <h:outputText value="#{myVar.name}">
>>>>>>>>>>
>>>>>>>>>> it's working.
>>>>>>>>>> When I try to use the same property (or another one) for the id of
>>>>>>>>>> the
>>>>>>>>>> component the text is correctly outputted but I get an empty id (I
>>>>>>>>>> put a _
>>>>>>>>>> in front to don't get exception):
>>>>>>>>>>
>>>>>>>>>> <h:outputText id="_#{myVar.name}" value="#{myVar.name}"> ID NOT
>>>>>>>>>> WORKING,
>>>>>>>>>> empty
>>>>>>>>>> <h:outputText id="_#{myVar.id}" value="#{myVar.name}"> ID NOT
>>>>>>>>>> WORKING,
>>>>>>>>>> empty
>>>>>>>>>>
>>>>>>>>>> Without underscore in front i get directly an exception:
>>>>>>>>>>
>>>>>>>>>> <h:outputText id="#{myVar.name}" value="#{myVar.name}">
>>>>>>>>>> <h:outputText id="#{myVar.id}" value="#{myVar.name}">
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> http://www.irian.at
>>>>>>>>
>>>>>>>> Your JSF powerhouse -
>>>>>>>> JSF Consulting, Development and
>>>>>>>> Courses in English and German
>>>>>>>>
>>>>>>>> Professional Support for Apache MyFaces
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Johannes Homuth
>>>>>>
>>>>>> -----------------------------------
>>>>>> SOURCEPARK Gesellschaft
>>>>>> für Softwareentwicklung mbH
>>>>>>
>>>>>> Johannes Homuth
>>>>>> Helmholtzstr. 2-9 Gebäude M
>>>>>> 10587 Berlin  Tel:    +49 (0)30/398 068 316
>>>>>> Fax:    +49 (0)30/398 068 39
>>>>>> e-mail: [EMAIL PROTECTED]
>>>>>> www:    www.sourcepark.de
>>>>>> -----------------------------------
>>>>>> Sitz der Gesellschaft: Berlin
>>>>>> Handelsregister: Amtsgericht Berlin-Charlottenburg, HRB 80254
>>>>>> Geschäftsführer: Matthias Barmeier, Harald Dürr
>>>>>> -----------------------------------
>>>>>> Diese E-Mail kann vertrauliche und/oder rechtlich geschützte
>>>>>> Informationen enthalten. Wenn Sie nicht der richtige Adressat
>>>>>> sind oder diese E-Mail irrtümlich erhalten haben, informieren
>>>>>> Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
>>>>>> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
>>>>>> E-Mail ist nicht gestattet.
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> http://www.irian.at
>>>>
>>>> Your JSF powerhouse -
>>>> JSF Consulting, Development and
>>>> Courses in English and German
>>>>
>>>> Professional Support for Apache MyFaces
>>>>
>>>
>>>
>>
>>
>> --
>>
>> http://www.irian.at
>>
>> Your JSF powerhouse -
>> JSF Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to