hmm.  i haven't yet heard or seen any support for Tools 2 from the
Spring folks.  i would at least just try swapping in the tools 2 jar.
if that works, then you might as well just try replacing your
toolbox.xml with a tools.xml.  i'm really not deeply familiar with how
Spring went about integrating toolbox support into their views.

i would try bringing this up in their forums.  if they aren't already
watching Tools 2, it'd be good for them to be aware that its API has
stabilized and it's pretty much just waiting on docs, updated examples
and maybe further feedback before final release.

though Spring is largely SpringSource's baby, it is still open source.
 so i suppose you could just try writing/contributing a
VelocityTools2View or a patch for VelocityToolboxView yourself.  i
wish i could offer time to help with that, but i've got higher
priorities at the moment.

feel free to keep up with more specific questions on this.  i am also
planning to write a doc to help framework devs (like the Spring guys)
integrate Tools 2 into their Velocity support.

On Wed, Apr 2, 2008 at 10:44 AM, Charles Harvey III <[EMAIL PROTECTED]> wrote:
> Ok.  Tougher question.  I use Spring as my framework so I never actually put
>  the VelocityLayoutServlet in my web.xml.  Instead, I have something like so
>  in my whatever-servlet.xml file:
>
>  <bean id="viewResolver"
> class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
>    <property name="viewClass"
> value="org.springframework.web.servlet.view.velocity.VelocityLayoutView"/>
>    <property name="cache" value="true"/>
>    <property name="prefix" value=""/>
>    <property name="suffix" value=".vm"/>
>    <property name="exposeRequestAttributes" value="true"/>
>    <property name="exposeSessionAttributes" value="true"/>
>    <property name="exposeSpringMacroHelpers" value="true"/>
>    <property name="layoutUrl" value="/layouts/default_layout.vm"/>
>    <property name="toolboxConfigLocation" value="/WEB-INF/toolbox.xml"/>
>  </bean>
>
>  So, what changes?  How do I make Spring aware that I am using the new
> tools-2.0?
>  The VelocityToolboxView seems to accommodate the tools-1.2 and tools-1.3
> when configuring
>  a tool:
>
> http://springframework.cvs.sourceforge.net/springframework/spring/src/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java?view=markup
>
>  So do I just need the change the above to point to /WEB-INF/tools.xml
> instead of toolbox.xml?
>
>  Does anyone else use Spring?  Has anyone tried the new tools setup with
> Spring?
>
>  Thanks again.
>
>
>  Charlie
>
>
>  Nathan Bubna said the following on 4/1/2008 3:16 PM:
>
>
>
> > yep, that's the idea.  as for the init() method, you only need it if
> > your tool needs access to the  initData for that scope (ServletContext
> > for application scope and ViewContext for request or session scope).
> > if your tool doesn't need access to any of those things, then it
> > doesn't need an init(Object) method.
> >
> > of course, this is all with Tools 1.3 or Tools 1.4.  with Tools 2,
> > things get even easier. :)
> >
> > On Tue, Apr 1, 2008 at 12:05 PM, Charles Harvey III <[EMAIL PROTECTED]>
> wrote:
> >
> >
> > > As far as your own tools goes, I want to make sure I've got it right:
> > >
> > >  Old:
> > >  -------------------------------------------------------------
> > >  public class MyTool implements ViewTool
> > >  {
> > >    private String theString;
> > >
> > >    public void init( Object o )
> > >    {
> > >        if( !( obj instanceof ViewContext ) )
> > >        {
> > >            throw new IllegalArgumentException( "Tool can only be
> > >  initialized with a ViewContext" );
> > >        }
> > >    }
> > >
> > >    public String getTheString()
> > >    {
> > >        return "this string comes from a velocity tool";
> > >    }
> > >  }
> > >  -------------------------------------------------------------
> > >
> > >
> > >  New:
> > >  -------------------------------------------------------------
> > >  public class MyTool
> > >  {
> > >    private String theString;
> > >
> > >    public void init( Object o )
> > >    {
> > >        if( !( obj instanceof ViewContext ) )
> > >        {
> > >            throw new IllegalArgumentException( "Tool can only be
> > >  initialized with a ViewContext" );
> > >        }
> > >    }
> > >
> > >    public String getTheString()
> > >    {
> > >        return "this string comes from a velocity tool";
> > >    }
> > >  }
> > >  -------------------------------------------------------------
> > >
> > >
> > >  Do I still need the init method?  Or can I skip that too?
> > >
> > >  Thanks.
> > >
> > >
> > >  Charlie
> > >
> > >
> > >
> > >
> > >
> > >  Nathan Bubna said the following on 4/1/2008 1:06 PM:
> > >
> > >
> > >
> > >
> > > > there are some issues with multi-line comments within macros in
> Velocity 1.5
> > > >
> > > >
> > >  >
> > >  > if you have written your own custom tools, then you'll find the
> > >  > ViewTool and Configurable interfaces have been axed in VelocityTools
> > >  > 1.4.  just remove the implements declarations for those interfaces.
> > >  > they are unnecessary, as Tools 1.4 will automatically look for their
> > >  > methods in any tool class.  if you haven't written any tools of your
> > >  > own, i don't think there's anything to be concerned about.
> > >  >
> > >  > that's all i can think of right now, but of course, feel free to ask
> > >  > questions/report problems here.
> > >  >
> > >  > On Tue, Apr 1, 2008 at 8:49 AM, Glenn Holmer <[EMAIL PROTECTED]>
> wrote:
> > >  >
> > >  >> I'm doing maintenance on an app that uses Velocity 1.4 and
> VelocityTools
> > >  >>  1.1, and would like to upgrade to Velocity 1.5 and tools 1.4.  Are
> there
> > >  >>  any gotchas I should watch out for?
> > >  >>
> > >  >>  --
> > >  >>  ____________________________________________________________
> > >  >>  Glenn Holmer                          [EMAIL PROTECTED]
> > >  >>  Software Engineer                        phone: 414-908-1809
> > >  >>  Weyco Group, Inc.                          fax: 414-908-1601
> > >  >>
> > >  >>
> > >  >>
> ---------------------------------------------------------------------
> > >  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >  >>  For additional commands, e-mail: [EMAIL PROTECTED]
> > >  >>
> > >  >>
> > >  >>
> > >  >
> > >  > ---------------------------------------------------------------------
> > >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >  > For additional commands, e-mail: [EMAIL PROTECTED]
> > >  >
> > >  >
> > >  >
> > >
> > >  ---------------------------------------------------------------------
> > >  To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >  For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to