Just wondering if any work is being done related to these JIRA requests:

http://mc4j.org/jira/browse/STS-262
http://mc4j.org/jira/browse/STS-268

This the UrlBuilder stuff.  I think it would be great to add this.  As
James Strachan suggested, it would be great if there is a
LifecycleStage for UrlParameter binding.  This would make CRUD-type
action beans easier to code, because you could just do this:

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

    private Long id;
    private User user;

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

    public Resolution save() {

    }

    @Before(stage=LifecycleStage.UrlParameterBinding)
    public void loadUser() {
        if(id != null) {
            user = userService.get(id);
        }
    }

}

Or the safer, more verbose way:

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

    private Long id;
    private User user;

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

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

    public Resolution create() {
        userService.create(user);
        return new RedirectResolution(SomeOtherActionBean.class);
    }

    public Resolution update() {
        userService.update(user);
        return new RedirectResolution(SomeOtherActionBean.class);
    }

    @Before(stage=LifecycleStage.UrlParameterBinding, on={"edit","update"})
    public void loadUser() {
        //Will throw exception if id is null or user is not found
        user = userService.get(id);
    }

}

To support this, will there be some kind of stripes url tag that will
allow you to generate a url to this event?  Maybe like this:

<stripes:url class="com.mycompany.stripes.UserActionBean">
  <stripes:urlParam name="id" value="${user.id}"/>
  <stripes:urlParam name="event" value="edit"/>
</stripes:url>

-------------------------------------------------------------------------
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