What I mean is, clients *never* access a .jsp file by URL, e.g.
"http://www.example.com/app/foo.jsp";. All URLs seen by the client are
mapped to servlets, not JSP files. All client requests are handled by
servlets, not JSP files. The servlets call various other Java objects
to do their jobs, and at the end of each servlet is a call to
RequestDispatch.forward to invoke the JSP file that formats the
servlet's output.

The reason for doing it this way is to separate app logic from page
layout. I find it difficult to code a substantial app by mixing Java
code into JSP pages, and it's lots easier to modify the format of a
web page if the app logic isn't all tangled up in it.

This is an application of the model-view-controller (MVC) method of programming.
-- 
Len



On Mon, Mar 9, 2009 at 15:04, Gregor Schneider <rc4...@googlemail.com> wrote:
> Len,
>
> On Mon, Mar 9, 2009 at 7:47 PM, Len Popp <len.p...@gmail.com> wrote:
>>
>> Really? That's how I write all my apps! Requests are handled by
>> servlets, which forward to JSPs to format their output. Since the JSPs
>> are not intended to be served to clients directly, they must reside
>> under WEB-INF.
>>
>
> Well, that's really new to me. I'm using JSPs without using Spring,
> and the JSPs I'm writing all reside in an application's appbase (i.e.
> ${webapps}/myapp).
> They are obviously not served directly to the client since Tomcat
> compiles them beforehand so that the client always gets the
> OutputStream of said JSPs.
>
> I've just checked my books here (ok, might be a bit outdated),
> however, in none of them I found any other recommendation but to put
> the JSPs into ${webapps}/myapp except your beans which go to
> /WEB-INF/classes or /WEB-INF/lib/someJar.jar.
>
> However, I'm always eager to learn, and if that's not a
> Spring-thingie, I'd appreciated if there's any liturature available on
> the web declaring this as a best practise.
>
> Rgds
>
> Gregor
> --
> just because your paranoid, doesn't mean they're not after you...
> gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
> gpgp-key available @ http://pgpkeys.pca.dfn.de:11371
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to