Velocity
  1. Velocity
  2. VELOCITY-12

Access to public member variable of a class

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.x
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: PC

      Description

      It would be nice if I could reference public instance variables in a class that
      is put in the velocity context using a syntax such as
      $theClass.instanceVarName. I am aware that this syntax is used to reference
      the getInstanceVarName() method of the class that is put in the context...maybe
      a variation on the syntax could be used for instance variables. I am also
      aware that it is probably not good to expose instance variables as public,
      however the classes I am dealing with are generated via a CORBA IDL compiler.
      My servlet makes a CORBA call, which returns data in such an object (public
      instance vars, no accessor methods), and it would be nice if I could stuff this
      object into the velocity context and reference it directly in a template. What
      I have to do with the current implementation of velocity is wrap these IDL
      compiler generated classes to provide get methods for the instance variables.
      This is very easy, but adds up to a lot of classes that exist merely so public
      members can be accessed via a get method.

      <bootlickingon> I evaluated velocity as an alternative to JSP for use on my
      current project, and Velocity wins hands down, even given this
      inconvenience.</bootlickingoff>

      1. VELOCITY-12.patch
        26 kB
        Candid Dauth

        Activity

        Rich Doyle created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 3096 12314882
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12324887 ] Default workflow, editable Closed status [ 12551862 ]
        Mark Thomas made changes -
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551862 ] jira [ 12552387 ]
        Nathan Bubna made changes -
        Resolution Won't Fix [ 2 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Candid Dauth made changes -
        Attachment VELOCITY-12.patch [ 12475140 ]
        Claude Brisson made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Assignee Claude Brisson [ claude ]
        Fix Version/s 2.x [ 12310291 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Claude Brisson
            Reporter:
            Rich Doyle
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development