Paul Yunusov wrote:

My first guess was that in LoginServlet I could call

  // "ub" is reference variable of instantiated UserBean
  HttpSession session = getServletContext().getSession();
  session.setAttribute("nameOfInstance", ub);

But I do not think that this is right.  Later JSPs can access this
instance of UserBean using id="ub" ????

No, the line of thought is correct but there are two problems:
1) there is no getSession() in ServletContext, use getSession() in HttpServletRequest. (HttpSession, as the name suggests, is specific to HTTP while ServletContext is application layer protocol agnostic).
2) id attribute in the jsp:useBean tag would be "nameOfInstance", not "ub".
Oh, okay -- a slip of the mind there. Is this the official way to do it, because I can't find in my book (Core Servlets) where it says that the <jsp:useBean> tag knows to look in the session for the string used in the "id" attribute.

I want to avoid using a workaround since I'm just starting out.

Thanks again Paul!


Erik


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to