On Tue, 21 Mar 2000, Thomas Heller wrote:
> Hi there!
>
> Maybe I got something wrong, but right now I can't figure out how to do
> this.
>
> I've written an servlet which retrieves some informations from a database.
> The Servlet processes each Get/Post Request and so provides all the output.
> Right now I don't feel confident with the way I keep my HTML Code. I'd like
> to seperate it completly from my servlet code. A proper way to do this,
> seemed to be a JSP Page.
>
> I want my JSP Page to be able to make use of every Object I have in my
> Servlet. But I can't seem to be able to work with any Object I have in my
> Servlet.
>
> Does anyone have a hint for me how I can share objects between Servlets and
> JSP? I don't like these beans. ;)
>
> I have found several template frameworks but I don't like them either. As
> said, I'd like my JSP (or whatever) File to be able to use all Objects I
> have in my Servlet. I also don't like to pass the object through a session
> ...
Sounds like you're not going to like servlets and JSP pages very much :-).
One of the key issues you might not have considered is that servlets and
JSP pages operate in a multithreaded environment. One of the things that
means is that, if two users submit requests for the same servlet at the
same time, those requests will run simultaneously. If you were using
instance variables in the servlet to store them, the two users are going
to stomp on each other.
To avoid this problem, you need to store things related to a particular
request or user in separate objects. That's what the beans do for you --
and that's why you should learn to use them even if you don't currently
feel comfortable with them.
One source of information on good practices in designing large web-based
applications is the Java2 Enterprise Edition (J2EE) "Best Current
Practices" manual on web application design. The chapters on servlets and
JSP are very useful, even if you don't need a full blown application
server.
You can get this document by going to <http://java.sun.com/j2ee> and
following the links for documentation downloads.
>
> Thanks in advance,
> Thomas
>
Craig McClanahan
___________________________________________________________________________
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