开发者

Jsf 2.0 Custom Tags With Primefaces

I've created a panel (Refer - Help on JSF 2.0 Custom Components and Primefaces) according to my earlier post, using custom component from back end, and have populated tags to the panel like inputtext,listbox,dropdown menu,selectoneradio. How do I save these values on button click? I've nothing to do on the view - (front end) All the processing has to be done at the back end. An example for the same would be very helpful.

This is what I've done -

private Panel myPanel开发者_Python百科;

public Panel getMyPanel() {
    return myPanel;
}

public void setMyPanel(Panel myPanel) {
    this.myPanel = myPanel;

    if (myPanel.getChildCount() <= 1) {
        InputText input = new InputText();
        input.setValue("my dynamic text");
        myPanel.getChildren().add(input);
    }
}

Thanks in advance


You need to give all dynamically created UIForm, UIInput and UICommand components a fixed ID.

input.setId("someId");
// ...

Otherwise JSF can't find them in the view state to process the submitted values.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜