Struts 2
  1. Struts 2
  2. WW-738

Use ObjectFactory in velocityManager for setting webwork.velocity.contexts

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: WW 2.0, WW 2.1, WW 2.1.1, WW 2.1.2, WW 2.1.3, WW 2.1.4, WW 2.1.5, WW 2.1.6, WW 2.1.7
    • Fix Version/s: WW 2.2
    • Component/s: XML Configuration
    • Labels:
      None

      Description

      This would allow chained context's to be able to be loaded from spring or other object factorys.

      It is a simple one line change in the init() method:

      FROM:

      VelocityContext velocityContext = (VelocityContext)
      ObjectFactory.getObjectFactory().buildBean(Class.forName(classname));

      TO:

      VelocityContext velocityContext = (VelocityContext)
      ObjectFactory.getObjectFactory().buildBean(classname);

      e.g. don't do Class.forName. Let the object factory figure it out.

      after this toolbox like things can be wired in.

      e.g

      <bean id="springToolboxContext"
      class="org.apache.velocity.VelocityContext" >
      <constructor-arg>
      <map>
      <entry key="dateTool">
      <ref bean="dateTool"/>
      </entry>
      </map>
      </constructor-arg>
      </bean>

      <bean id="dateTool" class="org.apache.velocity.tools.generic.DateTool"/>

      Matthew Payne

        Activity

        Hide
        Matthew Payne added a comment -

        Changed to VelocityContext velocityContext = (VelocityContext)
        ObjectFactory.getObjectFactory().buildBean(classname);

        Show
        Matthew Payne added a comment - Changed to VelocityContext velocityContext = (VelocityContext) ObjectFactory.getObjectFactory().buildBean(classname);
        Hide
        Matthew Payne added a comment -

        This is closed.
        VelocityManager is fixed in cvs. I have no ability to close in jira though.

        Show
        Matthew Payne added a comment - This is closed. VelocityManager is fixed in cvs. I have no ability to close in jira though.

          People

          • Assignee:
            Matthew Payne
            Reporter:
            Matthew Payne
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development