Hello,

I thought I'd throw in my opinion on JSP vs. Servlets with JSPs.

THe reason I use servlets with JSPs is so I don't have to embed html in my
servlet code. I can keep the view separate from the model (business
logic/data) which is a better design for anything but trivial projects. I
use a core servlet to respond to http requests and forward the request
(with any other attributes) to a java server page (using the
RequestDispatcher object) which displays the response. You could, I
suppose, use a JSP controller and then other JSPs for display purposes but
I don't really see the point. Besides, embedding code in html is just plain
ugly let alone difficult to maintain (and isn't that the point of JSP?). If
you design cool looking web pages and want to embed a little code to add
some functionality, go for it...but if you're developing larger systems
then a better design approach should be taken.

- Mike

Michael G. Thompson
Team Lead/P.A.A.
Video on Demand Development Group
iMagicTV
(506) 631-3342
[EMAIL PROTECTED]

-----Original Message-----
From:   Rakesh Bhat [SMTP:[EMAIL PROTECTED]]
Sent:   Friday, September 08, 2000 1:51 AM
To:     [EMAIL PROTECTED]
Subject:        Re: session

Hi Laskowski,

As I understand , one uses JSP over Servlet because writing a JSP code is
simpler
compared to Servlet.Right ?
They are 2 different server side technologies.
I agree that JSP finally compiles into a Servlet.But , i don't understand
why one
will use JSP and servlet together ?
When you use JSP , all the objects like request , session... are available
implicitly which you get in servlet by extending HTTPServletRequest class.
right ?
So why one will use Servlet with JSP? As I understand one uses Java code in
a
separate bean because he/she wants to hide the business logic. Right ? Why
to keep
the same code in a servlet ?
Is my thinking correct or am i missing here something ?

Thx in advance
Rakesh.




Jacek Laskowski wrote:

> Angela Chow wrote:
> >
> > thanks for your reply :)
> >
> > i am very new to this concept.  Is there anywhere that
> > i can learn a little bit more about this?  I've notice
> > that Tomy Wong has put some code on his reply:
> >
> > HttpSession session = HttpServletRequest.getsession();
> > session.putValue("listenerobjcet",listener);
> > HttpSessionBindingEvent sessionbind = new
> > HttpSessionBindingEvent(session,"listener");
> > session.removeValue("listener");
> >
> > I don't know where to put this code, is the jsp page,
> > or in the bean?  If in the jsp page, is it on every
> > page?  How do i set the length of time for the
> > time-out?  I am getting little confused.  Please help
> > me out!
>
> I'd suggest that any Java code puts either in Tag Extensions or
> servlets. Going even a little further, try to follow Model 2 ideas.
> Create *one* servlet controller which controls who should do what. In
> that case, all JSPs do is only to display beans' state.
>
> To answer your question(s), just put it inside servlet controller, so
> the following JSP pages can use it. After that, just forward request to
> JSP to display it. When you becomes more familiar with that approach,
> you won't have to search all your code, just to check out whether
> everything is right. All you'll have to do is to open *one* servlet
> controller and modify it as you wish.
>
> Simple ? Yes, it should be:)
>
> >
> > angela
>
> Jacek Laskowski
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to