There really is no substitute for reading the API and the Servlet
Specification (check out Chapter 3).  The spec explains more than you
probably would ever need to know about servlets and their contexts.  You can
download it from java.sun.com/products/servlet.

Mark

-----Original Message-----
From: Madhavi Thottempudi [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 8:10 AM
To: Struts Users Mailing List
Subject: RE: global variables-update


Thanks for the explanation Mark! I understand it better now.
-M

At 07:50 04/10/2002 -0400, you wrote:
>It's not a bean; it's a helper (Action) class that is passed the servlet
>request and response objects, getting a "handle" on the servlet and can
>access the context in which the servlet resides.  The context is the
>global/application scope; the context object is like the central switching
>office to every object that lives within the application.
>
>Mark
>
>-----Original Message-----
>From: Madhavi Thottempudi [mailto:[EMAIL PROTECTED]]
>Sent: Friday, October 04, 2002 7:41 AM
>To: Struts Users Mailing List
>Subject: RE: global variables-update
>
>
>Hi Divakar!
>Thanks for the suggestion.
>
>I am still confused with one thing....
>In the example provided by struts (struts-example), I found that they are
>calling getServletContext from the Action bean to get a global/application
>scope attribute,
>but I felt it strange as there is no servlet passed to the Action Bean.
>
>The code is as follows:
>public final class SaveRegistrationAction extends Action {
>
>public ActionForward perform(ActionMapping mapping,
>                                   ActionForm form,
>                                   HttpServletRequest request,
>                                   HttpServletResponse response)
>          throws IOException, ServletException {
>
>          // Extract attributes and parameters we will need
>          Locale locale = getLocale(request);
>          .................
>          ..................
>          Hashtable database = (Hashtable)
>
servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
>          if (servlet.getDebug() >= 1)
>              servlet.log("SaveRegistrationAction:  Processing " + action +
>                          " action");
>          ........................................
>          .........................
>}
>}
>
>Any idea where this servlet is coming from???
>
>regards
>-M
>
>
>
>At 17:00 04/10/2002 +0530, you wrote:
> >Madhavi ,
> >
> >   You can look at the users guide available at the struts site. You can
>make
> >use of request.setAttribute( ) for setting up global variables.
> >    Refer 2.2 JavaBeans and Scope of user doc
> >
> >http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_model.html
> >Regards,
> >Divakar
> >
> >
> > > -----Original Message-----
> > > From: Madhavi Thottempudi [SMTP:[EMAIL PROTECTED]]
> > > Sent: Friday, October 04, 2002 4:46 PM
> > > To:   Struts Users Mailing List
> > > Subject:      Re: global variables-update
> > >
> > > I mean setting application scope variables - using setServletContext
or
> > > something like that and getting them back. Any ideas??
> > >
> > > Thanks again
> > > -M
> > >
> > > At 11:34 04/10/2002 +0100, you wrote:
> > > >Hi!
> > > >Where can I set global variables and get them back in Struts. Because
I
> > > >see that Action beans extending struts Action bean doesn't get
servlet
>in
> > >
> > > >their perform method.
> > > >
> > > >public ActionForward perform(ActionMapping mapping,
> > > >                                 ActionForm form,
> > > >                                 HttpServletRequest request,
> > > >                                 HttpServletResponse response)
> > > >
> > > >Any suggestions???
> > > >
> > > >Thanks
> > > >-M
> > > >
> > > >
> > > >--
> > > >To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > > Madhavi T
> > > E-Learning Systems Group
> > > CARET, University of Cambridge
> > > 16 Mill Lane
> > > Cambridge CB2 1SB
> > >
> > > Tel: +44 (0) 1223 765382
> > > [EMAIL PROTECTED]
> > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >DISCLAIMER: Information contained and transmitted by this E-MAIL is
> >proprietary to Mascot Systems Limited and is intended for use only by the
> >individual or entity to which it is addressed, and may contain
information
> >that is privileged, confidential or exempt from disclosure under
applicable
> >law. If this is a forwarded message, the content of this E-MAIL may not
>have
> >been sent with the authority of the Company. If you are not the intended
> >recipient, an agent of the intended recipient or a person responsible for
> >delivering the information to the named recipient, you are notified that
>any
> >use, distribution, transmission, printing, copying or dissemination of
this
> >information in any way or in any manner is strictly prohibited. If you
have
> >received this communication in error, please delete this mail & notify us
> >immediately at [EMAIL PROTECTED] Before opening attachments,
> >please scan for viruses.
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>Madhavi T
>E-Learning Systems Group
>CARET, University of Cambridge
>16 Mill Lane
>Cambridge CB2 1SB
>
>Tel: +44 (0) 1223 765382
>[EMAIL PROTECTED]
>
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Madhavi T
E-Learning Systems Group
CARET, University of Cambridge
16 Mill Lane
Cambridge CB2 1SB

Tel: +44 (0) 1223 765382
[EMAIL PROTECTED]





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

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

Reply via email to