-
1. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Sep 28, 2007 2:58 PM (in response to asookazian)Ok, now there is no exception (using only the Seam SFSB, not the manage bean anymore), but the dataTable does not render on the screen.
Using the <s:debug> tag, I see the following in the component tree:<HtmlDataTable border="-2147483648" first="0" id="_id22" rendered="true" rowIndex="-1" rows="0" transient="false" var="myItem" binding="#{userRoleSearch.dynamicDataTable}"/>
-
2. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Sep 28, 2007 3:01 PM (in response to asookazian)Here is the dynamic populator method. Looks like the value attribute is not being bound (it wasn't null in the Eclipse debugger)...
public void populateDynamicDataTable() { // Any columns? if (myList != null && myList.size() > 0) { dynamicDataTable = new HtmlDataTable(); // Get amount of columns. int columns = ((List) myList.get(0)).size(); // Set columns. for (int i = 0; i < columns; i++) { // Set header (optional). UIOutput header = new UIOutput(); header.setValue(headers); // Set output. UIOutput output = new UIOutput(); ValueBinding myItem = FacesContext .getCurrentInstance() .getApplication() .createValueBinding("#{myItem[" + i + "]}"); output.setValueBinding("value", myItem); // Set column. UIColumn column = new UIColumn(); column.setHeader(header); column.getChildren().add(output); // Add column. dynamicDataTable.getChildren().add(column); } } }
-
3. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Sep 28, 2007 3:42 PM (in response to asookazian)I noticed that the binding action only gets exec'd once per session (the SFSB has session scope).
-
4. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Sep 28, 2007 3:44 PM (in response to asookazian)As far as order of events, how do you know which actions/methods will be exec'd in what order?
For example:<s:div rendered="#{userRoleSearch.displayViewRolesDataTable}"> <h:dataTable value="#{userRoleSearch.myList}" var="myItem" binding="#{userRoleSearch.dynamicDataTable}"/> </s:div>
-
5. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Sep 28, 2007 6:47 PM (in response to asookazian)Ok, so it seems to be working perfectly AFTER I pulled the dataTable out into a separate .xhtml due to the hiding/showing (use of <s:div rendered...>) becoming a problem. I am redirecting as follows:
pages.xml<!-- added for the dynamic column support --> <page view-id="/filterRoles.xhtml"> <navigation from-action="#{userRoleSearch.viewRoles}"> <redirect view-id="/dynamic.xhtml"/> </navigation> </page>
The order of method executions in a JSF file is very tricky and illogical to me. The fact that sometimes a method called from a JSF gets called several times (seen in the debugger) is very illogical as well. -
6. Re: Binding HtmlDataTable to h:dataTable in Seam
pmuir Oct 1, 2007 9:46 AM (in response to asookazian)Binding back into components, is, in my opinion, a very bad idea. You can try http://docs.jboss.org/seam/2.0.0.CR1/reference/en/html/conversations.html#d0e5034 the uiComponent technique described here.
As for JSF calling methods multiple times, this is perfectly normal for JSF - you should get yourself a good JSF reference. -
7. Re: Binding HtmlDataTable to h:dataTable in Seam
asookazian Oct 1, 2007 12:51 PM (in response to asookazian)"pete.muir@jboss.org" wrote:
Binding back into components, is, in my opinion, a very bad idea. You can try http://docs.jboss.org/seam/2.0.0.CR1/reference/en/html/conversations.html#d0e5034 the uiComponent technique described here.
As for JSF calling methods multiple times, this is perfectly normal for JSF - you should get yourself a good JSF reference.
I have the Java Server Faces book by Bergsten. What specifically is the problem with using binding back into components? I didn't see any negatives on this technique. Is it something that has to do with JSF and Seam regarding this technique?? thx. -
8. Re: Binding HtmlDataTable to h:dataTable in Seam
pmuir Oct 14, 2007 5:45 AM (in response to asookazian)"asookazian" wrote:
I didn't see any negatives on this technique. Is it something that has to do with JSF and Seam regarding this technique?? thx.
IMO it tends to indicate bad design and a lack of proper separation of the UI and business layer (unless of course you bind your components in UI layer java). Also, with facelets and seam there are better ways to do the same e.g. injection via uiComponent or a facelets handler.