On Wed, 10 Jan 2001, dferugson wrote:

> You make mention to this technique as being model 2.
> This make me assume that this should be documented somewhere.
> Can you point me to a few resources?

Sure.  

http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html

This is the one that I got started with when it first came out.

> 
> I have thought that I could merely store the bean data in the session.
> But I wasn't sure how exactly to store it/how to get it from the jsp.

Ok, it's getting at the data from your JSP that causes so much grief for
people.  Either you write the code in the JSP to call getAttribute on the
session/request objects *or* you come up with some custom tags to do that
for you.

Whether it goes into the session or request context (or application
context) really depends on how long the data should live.  For the most
part you will be using the request context to pass data from your servlet
to jsp.

> Also, if I instantiate a bean in the servlet then include the jsp then
> it would be available?
> 

Well, I suspect you'll be doing forward() a lot more than you will be
doing include().

Check out the specs (both servlet and JSP) - a quick grep for
setAttribute, getAttribute and RequestDispatcher ought to be enough info.

Trevor

> d.
> 
> Trevor Squires wrote:
> > 
> > Despite other people recommending that you checkout project 'X' or project
> > 'Y' api, perhaps you should first look at the servlet/jsp api.
> > 
> > You have three contexts to play with for intra-servlet communication
> > (after all a jsp is just a servlet), application, session and request.
> > 
> > The simplest thing you can do is read the javadoc for HttpServletRequest,
> > namely the [get|set]Attribute calls.
> > 
> > I can't say that this is the "best" way to communicate between your
> > servlet and your JSP but if you're new to model 2 (which is what you are
> > describing) it is definately the "first" way you should try.
> > 
> > Trevor
> > 
> > On Wed, 10 Jan 2001, dferugson wrote:
> > 
> > > I would like to use servlets for my jndi and communication to my ejb and
> > > I would like the servlet to somehow place information given to it from
> > > the ejb into a javaBean that can then be used by the jsp. This way jsp
> > > developers need to know nothing about ejb.
> > >
> > > What is the best way to have the servlet pass to the jsp?
> > >
> > > Thanks.
> > >
> > 
> > --
> > --------------------------------------------------------------
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > List Help?:          [EMAIL PROTECTED]
> 
> 



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to