[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[Home]
Re: Accessing servlets object from jsp
> Martin Krivosik wrote:
> > -A request comes in to a servlet
> > -Another way to achieve the same effect is shown in the JavaServer Pages
> > -request model below. The client makes a request that is handled by a Java
> > -servlet. The servlet then generates the content that will be displayed
> > -in the HTML page. In this example, the servlet uses JDBC to communicate
> > -with a database in order to obtain the content.
> > In my application a Im doing it this way. Servlets generates from some
> > pseudotemplates HTML code. Now I will servlet generation of jsp
> > and processing by jspServlet
> >
> > -The resulting content is then wrapped into a bean which is passed to a
> > -JavaServer Pages file.
> > -The JavaServer Pages file uses the content generated by the servlet
> > -and presents it in HTML.
> > This I cannot uderstand. From my servlet i create an object, initialize,
> > make db query and store some data. How can I access this one object from jsp
> > page? Then can I print stored data to a page.
> > Summary:
> > How can I form jsp page acces object created by servlet?
>
> The way it should work is like this:
> a) the servlet creates a bean.
> b) the servlet puts the bean in the request object (using ServletRequest.setAttribute()).
> c) the servlet class the JSP page (using the RequestDispatcher methods
> of servlet API 2.1).
> d) the JSP page gets the bean from the request object (using ServletRequest.getAttribute()).
>
> However, steps b and c depends on your servlet engine supporting servlet
> API 2.1. Most do not do this yet.
Which servlet engines do support the servlet API 2.1 ??? (I need a
solution for IIS on
Windows NT or should we use the Java Web Server?)
Are there other ways to do this whole thing.
Could you please cc the answer directly to me, please:
mailto:mmarschall@ds-global.de
Thanks in advance,
Matthias Marschall