How to put an object into the application scope from a plugin interface
Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi
Re: How to put an object into the application scope from a plugin interface
hi THink you are slightly wrong syntax for init method is ublic void init(ActionServlet servlet, ApplicationConfig applicationConfig) throws javax.servlet.ServletException { } So you can access Application object and can set the attribute intop it Regards Gary - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 4:21 PM Subject: How to put an object into the application scope from a plugin interface Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to put an object into the application scope from a plugin interface
Which interface are you talking about, i'am using org.apache.struts.action.PlugIn isn't it the good one ? Actualy it is working for me ! Mehdi - Original Message - From: Gurpreet Dhanoa [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:10 AM Subject: Re: How to put an object into the application scope from a plugin interface hi THink you are slightly wrong syntax for init method is ublic void init(ActionServlet servlet, ApplicationConfig applicationConfig) throws javax.servlet.ServletException { } So you can access Application object and can set the attribute intop it Regards Gary - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 4:21 PM Subject: How to put an object into the application scope from a plugin interface Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to put an object into the application scope from a plugin interface
Mehdi i am talking about the same interface which is working onto my end which versio you are using - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 5:06 PM Subject: Re: How to put an object into the application scope from a plugin interface Which interface are you talking about, i'am using org.apache.struts.action.PlugIn isn't it the good one ? Actualy it is working for me ! Mehdi - Original Message - From: Gurpreet Dhanoa [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:10 AM Subject: Re: How to put an object into the application scope from a plugin interface hi THink you are slightly wrong syntax for init method is ublic void init(ActionServlet servlet, ApplicationConfig applicationConfig) throws javax.servlet.ServletException { } So you can access Application object and can set the attribute intop it Regards Gary - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 4:21 PM Subject: How to put an object into the application scope from a plugin interface Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to put an object into the application scope from a plugin interface
I'm using struts 1.1 and in java doc it is said that ApplicationConfig is deprecated and we must use now ModuleConfig. If you take a look on the tiles pluggin you will find that it implements this interface. my question is how to put in the ModuleScope an object, and how to retrieve it again? Mehdi - Original Message - From: Gurpreet Dhanoa [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:47 AM Subject: Re: How to put an object into the application scope from a plugin interface Mehdi i am talking about the same interface which is working onto my end which versio you are using - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 5:06 PM Subject: Re: How to put an object into the application scope from a plugin interface Which interface are you talking about, i'am using org.apache.struts.action.PlugIn isn't it the good one ? Actualy it is working for me ! Mehdi - Original Message - From: Gurpreet Dhanoa [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 11:10 AM Subject: Re: How to put an object into the application scope from a plugin interface hi THink you are slightly wrong syntax for init method is ublic void init(ActionServlet servlet, ApplicationConfig applicationConfig) throws javax.servlet.ServletException { } So you can access Application object and can set the attribute intop it Regards Gary - Original Message - From: EL AKARI Mehdi [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, December 19, 2003 4:21 PM Subject: How to put an object into the application scope from a plugin interface Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to put an object into the application scope from a plugin interface
EL AKARI Mehdi wrote: Hi, I'm writing a struts plugin, and i need to put an object into the application scope. How can i do this. Note that the plugin interface contains the following methods: public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException ; public void destroy() ; thanks Mehdi The easiest way is to use the ActionServlet object to get the ServletContext and push everything in that. The code to do it is pretty simple context = servlet.getServletContext(); context.setAttribute(KEY, object); Then, within a page when you need to get something out you just retrieve the ServletContext and get the attribute back out. Example : context = servlet.getServletContext(); Object retrievedObject = (Object)context.getAttribute(KEY); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]