We have just begun using WebKit and PSP and are using an MVC approach very
similar to what you describe. In our design, we have a "master servlet"
which is responsible for processing requests from each psp. All requests
include a command identifier, which is mapped to a particular function
within a particular class. The master servlet instantiates the class (as
a can with session scope) and invokes the function, where all the business
logic for processing the request resides. After the function returns, the
request is forwarded, via forwardRequestFast() to the appropriate psp. A
lot of the ideas for our design are based on a chapter in a JSP book, "Web
Development with JavaServer Pages", by Fields and Kolb, Manning
Publications (Ch 8).
Hamish Lawson wrote:
> In Jason Hunter's critique of JSP, he relates how some Java
> programmers have tried to avoid the awkardness of having business logic
> embedded in HTML by moving the logic out to a Bean and having it called
> from the JSP page. He notes that a JSP page used in this way is really
> 'view', a component used to display the results of a client request.
> then the question arises of why submit a request directly to a 'view'
> What if the targeted 'view' isn't the proper view for that request?
> After all, many requests have several possible resulting views. For
> example, the same request might generate a success page, a database
> exception error report, or a required parameter missing error
> report. The same request might also generate a page in English or a
> page in Spanish, depending on the client's locale. Why must a
> directly submit its request to a view? Shouldn't the client make a
> request to some general server component and let the server
> determine the JSP view to return?
> This belief caused many people to adopt ... the model-view-
> controller pattern. With this design, requests are submitted to a
> servlet 'controller' that performs business logic and generates an
> appropriate data 'model' to be displayed. This data is then passed
> internally to a JSP page "view" for rendering, where it appears to
> the JSP page like a normal embedded JavaBean. The appropriate JSP
> page can be selected to do the display, depending on the logic
> inside the controlling servlet. The JSP page becomes a nice
> I've begun looking at WebKit and PSP, and I'm wondering whether PSP can
> be employed in such a model-view-controller approach. From my intial
> reading I get the impression that the only approach for using PSP pages
> is to have them be the direct recipients of requests; is that the case?
> Hamish Lawson
>  http://www.servlets.com/soapbox/problems-jsp.html
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
> Webware-discuss mailing list