Hi,

First of all, I promise I'm not trolling. I'm going to say some critical
things about Stripes here, but my intention is to understand whether I'm
missing something, not to offend. If you don't like to read criticism of
your favorite framework, you should probably not read any further. Now that
we've got that out of the way......

My web framework background is in SpringMVC (and Grails). In SpringMVC a
request handler looks like this:

// ANNOTATIONS OMITTED FOR BREVITY
class MyController {
    ModelAndView showUserProfile(Integer userId) {
        
        UserProfile userProfile = userService.getProfile(userId);
        
        // An object that encapsulates the logical view name and data to be
displayed 
        return new ModelAndView("userProfile", userProfile);
    }
}


In Stripes, the equivalent ActionBean would look something like


// ANNOTATIONS, GETTERS AND SETTERS OMITTED FOR BREVITY  
class MyActionBean extends BaseActionBean {

    private Integer userId;
    private UserProfile;  

    Resolution showUserProfile() {
        
        this.userProfile = userService.getProfile(userId);
        
        // An object that encapsulates the logical view name and data to be
displayed 
        return new ForwardResolution("/userProfile.jsp");
    }
}

What bugs me about the Stripes approach is that the request parameters and
the model (UserProfile) are not scoped to the relevant handler method. In
most cases, a controller class has more than one handler, and I really
dislike the fact that there's no way to tell just by looking at the code
which request params and view model go with which handler method. I know you
could put each handler in its own class, but that will create a whole other
set of problems.

Fundamentally, having variables which should be scoped to a single method
scoped to a single class, feels like bad OO practice (poor encapsulation).
Am I missing something, or is this just something that most Stripes users
don't care about?




-- 
View this message in context: 
http://old.nabble.com/request-response-scoping-tp31050264p31050264.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to