MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1018

Default JSF Converters evaluate value-bindings only at converter creation time

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.1.7-SNAPSHOT
    • Fix Version/s: None
    • Component/s: New Component
    • Labels:
      None
    • Environment:
      Tomcat 5.0.28
      MyFaces 1.15

      Description

      After a longer discussion in the Nabble-Forum with Mike Kienenberger from your Team he advised me to open this issue.

      Problemdescription:
      All the myfaces-components evaluates value binding within the rendering-phase but the JSF-components do this step in an earlyer step.
      So we have the following problem. We want to use a columns-tag from tomahawk and inside this tag a converter from jsf. Now the converter has an EL-Expression as an attribute. This EL-Expression should set through the var-variable from the columns-tag. As described above the result of that is that the EL-Expression can't be resolved by the converter-tag because the var-variable is not set at that phase.

      Quote from Mike Kienenberger:
      "Converters that evaluate at rendertime would be an excellent addition
      to Tomahawk. I don't currently see any Tomahawk equivalents of the
      existing converters. "

      I can only say that that is absolutly important for our development because at the moment we are totally blocked by this bug.

      For a better understanding here are some samplefiles which should describe the problem enought:
      ListItem.java
      public class ListItem {
      private String dateString;
      public ListItem()

      { dateString = "date"; }

      public String getDateString()

      { return dateString; }

      public void setDateString(String tollerString)

      { this.dateString = tollerString; }

      }

      MyBean.java
      import java.util.ArrayList;
      import java.util.List;
      public class MyBean {
      private List justAList;
      public MyBean()

      { justAList = new ArrayList<ListItem>(); justAList.add(new ListItem()); }

      public List getJustAList()

      { return justAList; }

      public void setJustAList(List justAList)

      { this.justAList = justAList; }

      }

      columnsTest.jsp
      <%@ page language="java" pageEncoding="ISO-8859-1"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <body>
      <f:view>
      <t:dataTable value="#

      {myBean.justAList}" var="rowData">
      <t:columns value="#{myBean.justAList}

      " var="columnData" >
      <h:inputText>
      <f:convertDateTime type="#

      {columnData.dateString}

      " />
      </h:inputText>
      </t:columns>
      </t:dataTable>
      </f:view>
      </body>
      </html>

        Issue Links

          Activity

          Hide
          Mike Kienenberger added a comment -

          The default core jsf converters all evaluate their value bindings at creation time rather than each time they're used, and this behavior cannot be changed because the available methods for setting the attribute values are in jsf-api.

          The problem that this introduces is that these converters cannot use variables as provided by flow-control components like UIData in converter value bindings. Once the converter is created the values have to remain constant.

          Ie, you can't fetch a row-specific type or pattern for f:convertDateTIme.

          It would be worthwhile to create Tomahawk versions of each converter which will take ValueBindings (like most JSF component attributes) which are evaluated at each use. The page syntax can remain the same but the java api for these converters would be different.

          Show
          Mike Kienenberger added a comment - The default core jsf converters all evaluate their value bindings at creation time rather than each time they're used, and this behavior cannot be changed because the available methods for setting the attribute values are in jsf-api. The problem that this introduces is that these converters cannot use variables as provided by flow-control components like UIData in converter value bindings. Once the converter is created the values have to remain constant. Ie, you can't fetch a row-specific type or pattern for f:convertDateTIme. It would be worthwhile to create Tomahawk versions of each converter which will take ValueBindings (like most JSF component attributes) which are evaluated at each use. The page syntax can remain the same but the java api for these converters would be different.
          Hide
          Leonardo Uribe added a comment -

          This issue will be closed as duplicate. A solution for this one was committed on MFCOMMONS-12

          Show
          Leonardo Uribe added a comment - This issue will be closed as duplicate. A solution for this one was committed on MFCOMMONS-12

            People

            • Assignee:
              Leonardo Uribe
              Reporter:
              Daniel Herb
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development