On 10/25/06, Patrick Lightbody <[EMAIL PROTECTED]> wrote:
> I think I know Tim's response to this:
>
> He'd say that by having a TypeConverter registered for the "id" field
> on your action, when the property is applied you could pull in the
> proper object.

FWIW how we do this kinda thing in Able in a Stripernate kinda way
would be like this...


@UrlBinding(/user/{user})
public class UserActionBean implements ActionBean {

   private User user;

   @DefaultHandler
   public Resolution get() {
       return new ForwardResolution("/WEB-INF/views/user.jsp");
   }

   public Resolution save() {

   }
}

Then we'd register a TypeConverter<User> which took the String of the
ID value and loaded the User via JPA/Hibernate/whatever.

i.e. the @UrlBinding would only need to extract the {foo} expressions
as Strings and inject them into the POJO like they were HTTP
parameters - using the existing type converter code.

I guess another option could be to support parameters on the action
methods - though its a bit more work to do (treating URI fragments as
pseudo http parameters is easier :)

e.g.

@UrlBinding(/user/{id})
public class UserActionBean implements ActionBean {

   private User user;

   @DefaultHandler
   public Resolution get(String id) {
       // am gonna do the conversion to a User myself here...
   }
}

but it could deal with more complex use cases; where multiple values
come from the URI to do some custom query etc.

-- 

James
-------
http://radio.weblogs.com/0112098/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to