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