Uploaded image for project: 'Jahia Community'
  1. Jahia Community
  2. JAHIA-4323

<template:field/> tag consistency

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Major
    • xCM 6.0
    • xCM 6.0
    • None

    Description

      The tag exposes into the page scope for the "valueBeanID" different types of objects
      Once it is an Integer or Float, once a PageBean, once a java.util.Date, JahiaFileField, a list of CategoryBean and, what is really interesting, fo SmallTextFields and BigTextFiellds it exposes ResourceBean (no matter if I do not use any resource markers)

      I just thought intuitively that the bean class, exposed as the value, should always be the same, say ValueBean with all possible getters for getInteger(), getDate(), getCategories(), getFile() and the common Object:getValue(), which will call internally corresponding method. Otherwise, it could be quite hard to understand why it always exposes different beans.

      There is a e-mail in the template_list mailing list. The guy is asking for how to get the length of the text in a BigText field.
      I am trying to use:
      <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
      <template:field name="mainContentBody" valueBeanID="mainBody" display="false"/>
      length: ${fn:length(mainBody)}

      But the mainBody is of type ResourceBean, so I need to do: ${fn:length(mainBody.value)}
      It is not a problem. The problem is explaining why in one case (for BigText fields) the bean has a getter for getValue() and for date fields (java.util.Date) it does not

      I would suggest we wrap the value into a dedicated class and provide corresponding getters.

      The changes will not break the existing code as toString() will return the same value as before.

      I am creating an entry in Crucible for review before doing something: http://10.8.37.247:8060/cru/AND-36/preview

      But it is really needed to do it earlier before template developers started to use the tag extensively

      TestRail: Results

        Attachments

          Activity

            People

              shyrkov Sergiy Shyrkov (Inactive)
              shyrkov Sergiy Shyrkov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                TestRail: Runs

                  TestRail: Cases

                    Packages

                      Version Package
                      xCM 6.0