1 Reply Latest reply on Sep 19, 2011 5:26 AM by julez

    Programmatically create UIList in UIDataTable

    julez

      I am creating a UIDataTable programmatically in RF 4.0 in Java, because I need a dynamic number of columns.

      Adding a simple column works nicely with something like this:

      col = new UIColumn();
      col.setId("rank");
      text = new HtmlOutputText();
      text.setValueExpression("value", expressionFactory.createValueExpression(elContext, "#{psmRow.rank}", String.class));
      col.getChildren().add(text);
      dataTable.getChildren().add(col);
      

       

      "psmRow" is the var element of my dataTable, the element "rank" gets accessed all right.

       

      But when trying to add a UIList like this

      UIList accs = new UIList();
      accs.setValueExpression("value", expressionFactory.createValueExpression(elContext, "#{psmRow.accessions}", String.class));
      accs.setValue("#{psmRow.accessions}");
      accs.setVar("acc");
      
      text = new HtmlOutputText();
      text.setValueExpression("value", expressionFactory.createValueExpression(elContext, "#{acc}", String.class));
      
      accs.getChildren().add(text);
      
      col.getChildren().add(accs);
      
      dataTable.getChildren().add(col);
      

      I am getting a weird error message, complaining like this

       

      Sep 16, 2011 12:59:48 PM org.apache.myfaces.renderkit.ErrorPageWriter handleThrowable
      SEVERE: An exception occurred
      javax.faces.FacesException: java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/sql/Result
          at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
          at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
      ...
      

       

      So why is the renderer suddenly trying to call some SQL stuff? The rendering of the page aborts after throwing the exception.

       

      The last thing I can see is, that the #{psmRow.accessions} gets executed, i.e. the getAccessions() method gets called.

       

      Any suggestions, how to add the UIList element correctly? Actually I want to add the element, which would be given as "rich:list" tag, but that should be the UIList, shouldn't it?

       

      Or is the whole creation of a dataTable like this not correct?

       

      Thanks,

      Julian