struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Raquepo" <rraqu...@primeorion.com>
Subject Re: using Struts datasource from a normal servlet
Date Fri, 18 Jul 2003 04:50:55 GMT
i got it.

here's what i did:

import org.apache.struts.Globals;
.....
 HttpServlet servlet = (HttpServlet)
getServletContext().getAttribute(Globals.ACTION_SERVLET_KEY);
MyService service = new MyService();
service.setServlet(servlet);

viola... it worked!

-richard

----- Original Message -----
From: "Richard Raquepo" <rraquepo@primeorion.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Friday, July 18, 2003 11:43 AM
Subject: using Struts datasource from a normal servlet


> i have a service class that i can use in my actions by passing the servlet
> variable to it
>     MyService service = new MyService(servlet);
>         or
>     MyService service = new MyService()
>     service.setServlet(servlet);
>
> this works fine on my action classes. My question is
> how can i use this service in a normal servlet.
>
> public class MyServlet extends HttpServlet{
>     ....
> }
>
> how can i pass the servlet variable and how to get it so i can use my
> service in a normal servlet. Please help me
> thanks.
>
> -richard
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message