You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wendy Smoak <We...@asu.edu> on 2003/07/18 05:02:12 UTC

RE: Can a form bean be repopulated w/same data if 'validate()' fa ils?

Martin wrote:
> I am curious, I cannot get the form to reappear with the data that I am
> validating. 

I have my forms in session scope and don't have this problem.  What scope
are your forms in?

-- 
Wendy Smoak

Re: using Struts datasource from a normal servlet

Posted by Richard Raquepo <rr...@primeorion.com>.
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" <rr...@primeorion.com>
To: "Struts Users Mailing List" <st...@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


using Struts datasource from a normal servlet

Posted by Richard Raquepo <rr...@primeorion.com>.
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


Re[2]: Can a form bean be repopulated w/same data if 'validate()' fa ils?

Posted by Martin Naskovski <mn...@san.rr.com>.
Thursday, July 17, 2003, 8:02:12 PM, you wrote:

WS> Martin wrote:
>> I am curious, I cannot get the form to reappear with the data that I am
>> validating. 

WS> I have my forms in session scope and don't have this problem.  What scope
WS> are your forms in?


Hi Wendy - I was initially placing them in the request scope. Then I
realized they had to be in the session if the contents are going to be
preserved between subsequent requests. Then after that ,I realized
that I was overwriting the session form bean each time I call
Load*Action....  Then I stopped doing that, and everything started
working like a charm.  Between before and after, maybe like 10 minutes
expired - thus my feeling like a dimwit - I just wasnt paying any
attention to what I was doing :).

Tnx.  You seem to read this list a lot :).

Martin

-- 


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