When I was using a servlet/jsp-solution to create web application some
time ago I put all the code logic inside the servlets. The servlets then
put the "data" they gathered inside some classes I wrote and then I added
that
class to the request object before redirecting to the JSPs.

Nowadays I use XML/XSL to separate the code from the logic. The servlets
gather the data and create the XML-document (DOM) and then use a static
XSL-document to generate the HTML.

I never really liked to use JSP, since I always ended up with (confusing)
code in the HTML anyway. In the above example, you still ended up with
lots of classInstance.getValue()-methods, like:

<%! MyBean myBean = (MyBean)request.getAttribute("mybean"); %>
<html>
        <head>
                <title> <%= myBean.getTitle() %> </title>
        </head>
        <body>
                Hello, <%= myBean.getUser() %>.
        </body>
</html>

etc.. (the actual JSP syntax might be wrong, haven't used it for a while).

[ Matthias Carlsson ]
[ Programmer (Java, CGI/Perl, Javascript, HTML) ] [ Web Designer ]
[ E-Mail : [EMAIL PROTECTED] ] [ ICQ: 1430647 ]

> -----Ursprungligt meddelande-----
> Fran: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]For Jim Cheesman
> Skickat: den 21 december 2000 09:19
> Till: [EMAIL PROTECTED]
> Amne: Re: when should I use servlet instead of jsp?
>
>
> At 17:52 20-12-00, you wrote:
> >Hi List,
> >
> >It may sound stupid, but that is the nature of a newbie like me.
> >I wonder if there is anything only can be accomplished by servlet.
> >I know jsp is indeed servlet, but I just don't want putting HTML
> >in my java code.
>
>
>
>
> IMHO the main difference is that jsp is focused on designers/presentation,
> and that servlets should be focused on strictly server-side
> issues - it's a
> lot easier to add presentation logic to a jsp than to a servlet,
> and it's a
> lot easier to design a flexible, upgradeable, maintainable servlet.
>
>
>
> As an aside, how do people go about developing jsp's?  My main process so
> far has been:
> 1. Think about what output I'm expecting
> 2. Code a jsp with lots of java code inside to acheive this
> 3. Check the output conforms
> 4. Start removing code (refactoring, if you like) to tags
> 5. Check again
>
> (I'm obviously ignoring the main system design here - the
> serlvets/beans/db/etc. that supports the jsp.)
>
> The main problem with this (as I see it) would come in a situation where
> the designer was distinct from the coder.  For those of you in this
> situtation, how do you get round this?
>
>
> Happy Christmas (or insert your own favourite festival here) to all!
>
> Jim Cheesman
>
>
>
>
>
>
> --
>
>                            *   Jim Cheesman   *
>              Trabajo: [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
>                Personal: [EMAIL PROTECTED] (34) 654 153 160
> All the things I really like to do are either immoral, illegal or
> fattening.
>    --Alexander Woollcott
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to