Questions like this on the [EMAIL PROTECTED] list please.
Thanks,
Manfred

On 5/22/07, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:



Hi,

I have to develop a new JSF component (component, tag and renderer).

The goal of this new component is easy... Put together severals input zone
in one single component.

I have done somethink that works... But i'm not sure I did everything
correctly. (in the State of Art)
--> Should be great if I can get a link to a complete tutorial or full
sample.

I create some code I don't like:
--> I have to "hardcoded" in the backingbean the "id" of my component and
then cast it to my component.
In my backingbean, the code looks like this:
UIComponent temp =
FacesContext.getCurrentInstance().getViewRoot().findComponent("dialog:dialog-body:mltext");
UIMltext myComponent = (UIMltext) temp;

During reading documentation I have found it is possible to "add" component
in the JSF tree dynamicly with code like this:
public void addControls(ActionEvent actionEvent)
{
        Application application =
FacesContext.getCurrentInstance().getApplication();
//Question: how to get controlPanel ???
        List children = controlPanel.getChildren();
        children.clear();
        for (int count = 0; count < numControls; count++)
        {
                HtmlOutputText output =
(HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
                output.setValue(" " + count + " ");
                output.setStyle("color: blue");
                children.add(output);
        }
}

Is it necessary in my component. What is the goal of adding component in the
tree?

I can now do: "MyValue myValues = myComponent.getValue()"

Then I have to do somethink like:

backingBean.setValue1(myValues.getValue1());
backingBean.setValue2(myValues.getValue2());
...
backingBean.setValuex(myValues.getValuex());

Is it correct? I should prefer the setter are called by JSF layer. Is it
possible?

Thanks a lot.

Stéphane


--
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