Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Need Velocity Dynamic expressions in ds.xml for loading titles of dynamic form fields

    I want to know if its possible to use Velocity Dynamic expressions in *.ds.xml for dynamically loading titles of dynamic form fields from the session.

    I want to retrieve the title values from the bean class managed by spring.

    Please help me by providing the appropriate velocity scripts in the title attributes in the ds.xml given below.

    <DataSource ID="formds" serverType="generic">
    <fields>
    <field name="field1" title="<Velocity Script for field1>" type="text" ></field>
    <field name="field2" title="<Velocity Script for field2>" type="text" ></field>
    <field name="field3" title="<Velocity Script for field3>" type="text" ></field>
    </fields>

    <serverObject lookupStyle="spring" bean="formDao"/>
    <operationBindings>
    <binding operationType="fetch" serverMethod="fetch">
    <serverObject lookupStyle="spring" bean="formDao"/>
    </binding>
    </operationBindings>
    </DataSource>

    #2
    The recommended approach is to use .jsp files to process your DataSources, to have access to locale-sensitive JSP tags that can access resource bundles. This is explained here under the topic of "DataSource Localization" - ignore everything else, which applies to SmartClient, not SmartGWT.

    This thread explains some further nuances of using this with SmartGWT.

    Comment


      #3
      @Isomorphic

      The situation I have in hand has nothing to do with locales.
      My need is to dynamically change the title of a field in the ds.xml so that i can avoid manually coding <FormItem>.setTitle("<title>").

      So can u please suggest me another approach?...

      Comment


        #4
        The .jsp approach works for locales or anything else that is per-user and done once per user session (since a DataSource definition is loaded only once).

        If it's something more frequent than that, and yet it seems inconvenient to call setTitle(), please explain the use case in detail, especially focusing on exactly how often the title might change.

        Comment

        Working...
        X