Dynamic JavaServer Faces components

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hev
    New Member
    • Sep 2007
    • 1

    Dynamic JavaServer Faces components

    Hi,
    I have problems with a dynamically created form using this code:
    Code:
      
      private HtmlPanelGrid grid; 
    
      public HtmlPanelGrid getDynamicPanelGrid() {
        if (grid == null) {
          Application app = FacesContext.getCurrentInstance().getApplication();
          grid = (HtmlPanelGrid) app.createComponent(HtmlPanelGrid.COMPONENT_TYPE);
    
          HtmlOutputText text = (HtmlOutputText) app.createComponent(HtmlOutputText.COMPONENT_TYPE);
          text.setValue("some text");
          grid.getChildren().add(text);
        }
    
        return grid;
      }
    I take it from http://wiki.apache.org/myfaces/Programmatic

    If I create dynamically an object HtmlInputText (a text field) in this way, I can't get the value of it, modified by the user.
    I tried with getValue(), getLocalValue() and I can't :(

    Can you help me please?
Working...