velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rickard Öberg <rick...@xpedio.com>
Subject Re: Visual Editor for Velocity
Date Tue, 07 Aug 2001 12:53:55 GMT
Hey

Dave Cramer wrote:
> I was thinking about something a tad different - namely an external file
> controls the actual data objects placed into the context by the
> controller.  You as the programmer just work on beans/objects to provide
> data...
> 
> Yes this is more or less what I had in mind. One thing that could be
> done is to present the user with all of the unresolved objects, and let
> them input values. This could be stored in a file for the next run
> 
> What pieces of code are around to start to make this a reality.

Oh, well, that works just great if you use the WebWork framework.
sourceforge.net/projects/webwork, get the CVS 'coz the Velocity
integration is hot off the press.

Simple WebWork tutorial follows.

Write code like this:
public class MyAction
  implements Action
{
  String someData;
  public String execute()
  {
    someData = "World";
    return SUCCESS;
  }

  public String getData()
  {
    return someData;
  }
}
--
add a controller/view mapping into views.properties like this:
myaction.action=MyAction
myaction.success=myaction.vm

and write a template (myaction.vm) like this:
Hello $data

and watch "Hello World" being generated.

That's it. Pretty straightforward. Add whatever data you want in your
Action, or use action chaining, i.e. let "myaction.success" point to
another action which can add more data to be accessible.

I'm working on the integration to make it as smooth as possible, but the
current CVS should be ok.

/Rickard

-- 
Rickard Öberg
Software Development Specialist
xlurc - Xpedio Linköping Ubiquitous Research Center
Author of "Mastering RMI"
Email: rickard@xpedio.com

Mime
View raw message