Announcement Announcement Module
Collapse
No announcement yet.
Values for result-type attribute in evaluate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Values for result-type attribute in evaluate

    Hi,

    I' m looking for a description for the attribute 'result-type' (Element evaluate).
    What are possible values for that attribute.
    I only found it in the documentation and the faces example:

    <evaluate expression="bookingService.findHotels(searchCriter ia)" result="flowScope.hotels" result-type="dataModel"/>

    Thanks in advance.
    Helmut

  • #2
    The result-type can either be a fully qualified class name, or an alias such as "dataModel", as long as there are appropriate converters registered with the application-wide conversion service.

    By default, the faces configuration registers the FacesConversionService (which extends Web Flow's DefaultConversionService) as the application-wide conversion service. The FacesConversionService is responsible for registering the DataModelConverter and for setting up the "dataModel" alias.

    The aliases available with the default Spring Faces configuration are:
    "dataModel", "string", "short", "integer", "int", "byte", "long", "float", "double", "bigInteger", "bigDecimal", "boolean", "class", and "labeledEnum".

    Comment


    • #3
      I think I need a little more clarification on this. In the sample app I don't see a converter that's registered, yet the application knows what to do with the hotel attributes, such as name, date, etc. using "dataModel" as the result-type.

      However, when I try to emulate the same thing, I get an exception saying:

      Property 'id' not found on type com.sun.faces.context.MyHttpServletRequestWrapper


      Is there something more I need to configure? I basically want it to render a datatable with my user's request results. Here is the pertinent code:

      Code:
      	<on-render>
      		<evaluate expression="pcnRequestService.findRequestsByUser('lsacco')" result="flowScope.requests" result-type="dataModel" />
      	</on-render>
      
      <h:dataTable id="requests" styleClass="summary" value="#{requests}" var="request" rendered="#{requests.rowCount > 0}">
      	<h:column>
      		<f:facet name="header">ID</f:facet>
      		#{request.id}
      	</h:column>
      I've verified that the query does indeed return results from the service layer.

      Thanks,

      Comment


      • #4
        I believe the problem you are encountering in this case is that "request" is an implicit JSF variable that maps to the HttpServletRequest object. Try using something other than "request" for your var in the DataTable.

        Comment


        • #5
          any documentation about &quot;dataModel&quot; for result-type?

          Originally posted by jeremyg484 View Post
          The result-type can either be a fully qualified class name, or an alias such as "dataModel", as long as there are appropriate converters registered with the application-wide conversion service.

          By default, the faces configuration registers the FacesConversionService (which extends Web Flow's DefaultConversionService) as the application-wide conversion service. The FacesConversionService is responsible for registering the DataModelConverter and for setting up the "dataModel" alias.

          The aliases available with the default Spring Faces configuration are:
          "dataModel", "string", "short", "integer", "int", "byte", "long", "float", "double", "bigInteger", "bigDecimal", "boolean", "class", and "labeledEnum".
          what is dataModel, who creates it and how is it used? where I can find more doucmentation about it?

          Comment


          • #6
            Originally posted by Chuck Zheng View Post
            what is dataModel, who creates it and how is it used? where I can find more doucmentation about it?
            public class FacesConversionService
            extends DefaultConversionService

            In addition to the standard Web Flow conversion, this service provide conversion from a list into a OneSelectionTrackingListDataModel using a "dataModel" alias for the type.

            In OneSelectionTrackingListDataModel you can find the getSelectedRow() method, and more...

            Comment


            • #7
              Originally posted by sliem View Post
              public class FacesConversionService
              extends DefaultConversionService

              In addition to the standard Web Flow conversion, this service provide conversion from a list into a OneSelectionTrackingListDataModel using a "dataModel" alias for the type.

              In OneSelectionTrackingListDataModel you can find the getSelectedRow() method, and more...
              Suppose i have something like:
              Code:
              <evaluate expression="billingService.deleteItems(flowScope.itemToAddList)" result="flowScope.itemToAddList" result-type="dataModel"/>
              where I send a list to the flow and use dataModel to convert it.
              I actually want to pass the wrapped data to a function but billingService.deleteItems(flowScope.itemToAddList .data) does not work. Is there some way to do this?

              Comment


              • #8
                Originally posted by lisadesouza89 View Post
                Suppose i have something like:
                Code:
                <evaluate expression="billingService.deleteItems(flowScope.itemToAddList)" result="flowScope.itemToAddList" result-type="dataModel"/>
                where I send a list to the flow and use dataModel to convert it.
                I actually want to pass the wrapped data to a function but billingService.deleteItems(flowScope.itemToAddList .data) does not work. Is there some way to do this?
                I assume the signature of the method is something like:
                Code:
                public java.util.List<A> deleteItems(java.util.List<B> inputList)
                So the method inside the Spring service returns a List. The result from the method is automatically converted to a dataModel type inside the evaluate expression.

                You can simply put some List in the flowScope with a <set /> like:
                Code:
                 <set name="flowScope.someList" value="...."/>
                Or through an evaluate, with a value giving a list and giving a flowScope variable inside the result attribute.

                Comment

                Working...
                X