Re: How to execute an initialization by using another servlet entry in web.xml
That sounds like a good method. I will try that. Thank you Nicolas. And thank you Geeta for your suggestion also. From: "Nicolas De Loof" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: Re: How to execute an initialization by using another servlet entry in web.xml Date: Thu, 24 Jun 2004 16:47:40 +0200 You should put the configuration object into application scope (servletContext) so it can be accessed from any servlet / jsp of your app. You can put MyXMLParserServlet itself into servletcontext and access it from struts action by: MyXMLParserServlet conf = (MyXMLParserServlet) getServlet().getServletContext().getAttribute(MyXMLParserServlet.CONF_BEAN); I'd suggest to define an interface for methods used by actions, to be able to change it easier if needed : class MyXMLParserServlet extends HttpServlet implements IConf { ... interface IConf { public final static String CONF_BEAN = "..." Element getElement(); } in action : IConf conf = (IConf) getServlet().getServletContext().getAttribute(ICond.CONF_BEAN); Nico. > Thank you for answering the first part of the question. > > What I am trying to do is, this MyXMLParserServlet(the new entry in web.xml) > parses an XML file. From my main ActionServlet.process() , I want to do > something like MyXMLParserServlet.getElement() . I won't be calling this > method from the init() method of my actionServlet. > > Thanks again. > > >From: Bill Siggelkow <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: How to execute an initialization by using another servlet > >entry in web.xml > >Date: Thu, 24 Jun 2004 08:51:29 -0400 > > > >If you are using approach #3 then extend HttpServlet. However, you should > >not need to be accessing the ActionServlet from the init servlet. Perhaps > >you could provide some more background on what you are trying to > >accomplish. > > > >manoj JC wrote: > > > >>Can somebody provide some sample code to do this. Please look at this link > >>http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization. > >>I want to use #3 approach mentioned in this link. > >> > >>My questions are : > >> > >>(A stupid question) Does this initialization class that I would specify in > >>web.xml, should it be a servlet,ActionServlet, or most importantly could > >>it be a just an ordinary java class. > >> > >>How do I access this servlet entry(this instance of class) from my main > >>ActionServlet? > >> > >>Thank you > >> > >>_ > >>MSN Toolbar provides one-click access to Hotmail from any Web page FREE > >>download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _ > Make the most of your family vacation with tips from the MSN Family Travel > Guide! http://dollar.msn.com > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Our name has changed. Please update your address book to the following format: "[EMAIL PROTECTED]". This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to execute an initialization by using another servlet entry in web.xml
You should put the configuration object into application scope (servletContext) so it can be accessed from any servlet / jsp of your app. You can put MyXMLParserServlet itself into servletcontext and access it from struts action by: MyXMLParserServlet conf = (MyXMLParserServlet) getServlet().getServletContext().getAttribute(MyXMLParserServlet.CONF_BEAN); I'd suggest to define an interface for methods used by actions, to be able to change it easier if needed : class MyXMLParserServlet extends HttpServlet implements IConf { ... interface IConf { public final static String CONF_BEAN = "..." Element getElement(); } in action : IConf conf = (IConf) getServlet().getServletContext().getAttribute(ICond.CONF_BEAN); Nico. > Thank you for answering the first part of the question. > > What I am trying to do is, this MyXMLParserServlet(the new entry in web.xml) > parses an XML file. From my main ActionServlet.process() , I want to do > something like MyXMLParserServlet.getElement() . I won't be calling this > method from the init() method of my actionServlet. > > Thanks again. > > >From: Bill Siggelkow <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: How to execute an initialization by using another servlet > >entry in web.xml > >Date: Thu, 24 Jun 2004 08:51:29 -0400 > > > >If you are using approach #3 then extend HttpServlet. However, you should > >not need to be accessing the ActionServlet from the init servlet. Perhaps > >you could provide some more background on what you are trying to > >accomplish. > > > >manoj JC wrote: > > > >>Can somebody provide some sample code to do this. Please look at this link > >>http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization. > >>I want to use #3 approach mentioned in this link. > >> > >>My questions are : > >> > >>(A stupid question) Does this initialization class that I would specify in > >>web.xml, should it be a servlet,ActionServlet, or most importantly could > >>it be a just an ordinary java class. > >> > >>How do I access this servlet entry(this instance of class) from my main > >>ActionServlet? > >> > >>Thank you > >> > >>_ > >>MSN Toolbar provides one-click access to Hotmail from any Web page – FREE > >>download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ > > > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _ > Make the most of your family vacation with tips from the MSN Family Travel > Guide! http://dollar.msn.com > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] Our name has changed. Please update your address book to the following format: "[EMAIL PROTECTED]". This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to execute an initialization by using another servlet entry in web.xml
Hi Manoj: Does your getElement() method depend on the individual request? If not you could declare it as a static method and then simply access it using MyXMLParserServlet.getElement(). Otherwise that method may need a request parameter in its signature or something else - depending on your needs.. Hth, Geeta > -Original Message- > From: manoj JC [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 24, 2004 10:17 AM > To: [EMAIL PROTECTED] > Subject: Re: How to execute an initialization by using another servlet > entry in web.xml > > > Thank you for answering the first part of the question. > > What I am trying to do is, this MyXMLParserServlet(the new > entry in web.xml) > parses an XML file. From my main ActionServlet.process() , I > want to do > something like MyXMLParserServlet.getElement() . I won't be > calling this > method from the init() method of my actionServlet. > > Thanks again. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to execute an initialization by using another servlet entry in web.xml
Thank you for answering the first part of the question. What I am trying to do is, this MyXMLParserServlet(the new entry in web.xml) parses an XML file. From my main ActionServlet.process() , I want to do something like MyXMLParserServlet.getElement() . I won't be calling this method from the init() method of my actionServlet. Thanks again. From: Bill Siggelkow <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: How to execute an initialization by using another servlet entry in web.xml Date: Thu, 24 Jun 2004 08:51:29 -0400 If you are using approach #3 then extend HttpServlet. However, you should not need to be accessing the ActionServlet from the init servlet. Perhaps you could provide some more background on what you are trying to accomplish. manoj JC wrote: Can somebody provide some sample code to do this. Please look at this link http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization. I want to use #3 approach mentioned in this link. My questions are : (A stupid question) Does this initialization class that I would specify in web.xml, should it be a servlet,ActionServlet, or most importantly could it be a just an ordinary java class. How do I access this servlet entry(this instance of class) from my main ActionServlet? Thank you _ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Make the most of your family vacation with tips from the MSN Family Travel Guide! http://dollar.msn.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to execute an initialization by using another servlet entry in web.xml
If you are using approach #3 then extend HttpServlet. However, you should not need to be accessing the ActionServlet from the init servlet. Perhaps you could provide some more background on what you are trying to accomplish. manoj JC wrote: Can somebody provide some sample code to do this. Please look at this link http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization. I want to use #3 approach mentioned in this link. My questions are : (A stupid question) Does this initialization class that I would specify in web.xml, should it be a servlet,ActionServlet, or most importantly could it be a just an ordinary java class. How do I access this servlet entry(this instance of class) from my main ActionServlet? Thank you _ MSN Toolbar provides one-click access to Hotmail from any Web page – FREE download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to execute an initialization by using another servlet entry in web.xml
Can somebody provide some sample code to do this. Please look at this link http://nagoya.apache.org/wiki/apachewiki.cgi?StrutsInitialization. I want to use #3 approach mentioned in this link. My questions are : (A stupid question) Does this initialization class that I would specify in web.xml, should it be a servlet,ActionServlet, or most importantly could it be a just an ordinary java class. How do I access this servlet entry(this instance of class) from my main ActionServlet? Thank you _ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]