velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donnie Hale" <>
Subject FW: Velocity & Struts - redux
Date Sun, 02 Dec 2001 22:49:50 GMT
Sorry if this gets double-posted. It hadn't shown up after several hours...


-----Original Message-----
From: Donnie Hale []
Sent: Sunday, December 02, 2001 12:41 PM
To: Velocity Users List
Subject: RE: Velocity & Struts - redux


I'm working on that kind of thing now. I've considered that it would be a
good idea to expose access to those things through an interface. Right now,
there's a terrible coupling that I just discovered from the forms, mappings,
actions, etc. to the servlet so they can get those things. The
"ResourceRepository" class I'm writing could implement that interface and
then those items could just be given a reference to the interface.

Unfortunately, no matter what, this means I'm going to have to make changes
in the action package that I was not expecting to have to make. :(



-----Original Message-----
From: Ted Husted []
Sent: Sunday, December 02, 2001 10:56 AM
To: Velocity Users List
Subject: Re: Velocity & Struts - redux

"Geir Magnusson Jr." wrote:
> The key thing about Velocity related to this issue is that with Velocity,
> you can access *any* public method of a Java class if the object is made
> available to the designer in the context.
> This is not limited to just JavaBean accessors (getters and setters), but
> anthing :
> $foo.getBar()
> $foo.woogie( "hellp", $array )
> $foo.getBar().barMethod( true )
> So the API of any of those objects in the scope contexts would be
> to the designer if they could get to those objects.

We could define a Struts Resources API easily enough. Here's what an
interface might look like.

public interface StrutsResources {

public void setResourceRequest(HttpServletRequest request);

public DataSource getDataSource();
public ActionErrors getActionErrors();
public Throwable getException();
public ActionFormBeans getActionFormBeans();
public ActionForwards getActionForwards();
public Locale getLocale();
public ActionMappings getActionMappings();
public MessageResources getMessageResouces();
public DiskMultipartRequestHandler getMultipartHandler();
public ActionServlet getActionServlet();
public Servlet getServlet();
public String getToken();

public ActionForm getActionForm(String name);
public ActionForward getActionForward(String name);
public ActionMapping getActionMapping(String name);

public ActionMapping getCurrentMapping();
public ActionForm getCurrentActionForm();


This would just be a wrapper that returned whatever from whatever
context. Most if it is just calling request.getAttribute($(*}_KEY).


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message