velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donnie Hale" <don...@haleonline.net>
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...

Donnie


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


Ted,

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. :(

Thoughts?

Donnie


-----Original Message-----
From: Ted Husted [mailto:husted@apache.org]
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
accessible
> 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).

-T.

--
To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:velocity-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message