Chris Bartley wrote:

> This thread seems to have gone off-topic a bit.  What about Jens' original question 
>about why ALL requests don't go through ActionServlet?:
>

Ideally, that's what happens.  Unfortunately, there are some practical realities that 
get in the way:

* What about your welcome page?  Usually, you want a URL like this:
        http://myhost/myapp
  to work, which will call up the index.html or index.jsp page.  One approach
  to this is to configure the URI of your login page as the "welcome" page
  for the app, using the <welcome-file> element in web.xml.

* What about bookmarks?  You have to be ready for the fact that users
  are going to *try* this, even if you do not want them to.  Alternatives have
  been presented to protect JSP pages from this kind of access.

* If you are switching from one view to another view (with no model manipulation),
  I cannot see that much difficulty in linking from one JSP page directly to
  another, but this is not particularly common.

In a servlet 2.3 environment, you will be able to enforce things like going through 
the controller using the Filter facility.  Until then,
though, we have to deal with issues like those listed above.

Craig


>
> Jens Rehpöhler wrote:
> > I'm watching this list quite a while and wondered why so
> > many people try to call there JSP pages directly from the
> > browser. In my understanding of the MVC pattern all requests
> > to your web application must be handled from the controller
> > servlet (ActionServlet). The only JSP page which could be
> > called directly is the start page of your application, in
> > most cases called index.jsp.
> >
> > By calling the JSP directly you don't seperate the view
> > completly from the logic. One bad example is the
> > struts-example application. Here, the user authentication is
> > done in every JSP page by a tag called <app:checkLogon/>. In
> >
> > my opinion the user authentication is absolutly LOGIC and
> > not VIEW. So it should be handled in the controller
> > (ActionServlet).
> >
> > <snip>
> >
> > Maybe I'm a bit to restrictive in the use of the MVC
> > pattern, so I'm very pleased to here why it is a good idea
> > to call your JSP directly without a call to the
> > ActionServlet.
>
> It seems (to me) that, in Struts, only form submissions follow MVC.  Or do i have it 
>all wrong?
>
> thanks,
>
> chris

Reply via email to