struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Fischer" <frank.fisc...@digitalnomads.ch>
Subject RE: How to initialize business service objects?
Date Thu, 13 Mar 2008 23:15:00 GMT

Hi Randy
Hi all

I just read a bit regarding Spring. As far as i understand its focus is on
J2EE appllications. I guess for what i want to do in a first step (my simple
chat app) it would be overkill to use Spring. Do i get that right?

I would prefere to go the most simple way if possible. So, just
instantiating my BusinessServiceObject the common way would be fine for me.
I just don't understand how can i get access to a BusinessServiceObject
created in one of my Action classes from another Action class. Just by
declaring it as static?

Second thing i don't understand is, when will action objects be intatiated
in the application server? As far as i remember from the early days of
servlet programming (when i had to do with this technology the last time)
the servlets are intantiated upon the first request. In a normal Servlet
based Web app i would have intiantiated BusinessServiceObjects in a filter
and placed them to the ServletContext. So i could be sure it's instantiated
before the first request arrives and i can get a reference to it from
anywhere in my web app.  But with Struts i don't see how i could do so.

I know this might sound a little bit confused. Can you help me to get on
track again?

Thanks for your help
Frank
 

> -----Original Message-----
> From: Randy Burgess [mailto:RBurgess@nuvox.com] 
> Sent: Thursday, March 13, 2008 11:02 PM
> To: Struts Users Mailing List
> Subject: Re: How to initialize business service objects?
> 
> For a POJO you can use dependency injection such as Spring or 
> Guice or you
> can instantiate the object the normal way
> 
> BusinessServiceObject bso = new BusinessServiceObject();
> 
> in your action class. There is nothing special about 
> accessing your BSO's in
> Struts.
> 
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
> 
> 
> 
> > From: Frank Fischer <frank.fischer@digitalnomads.ch>
> > Reply-To: Struts Users Mailing List <user@struts.apache.org>
> > Date: Thu, 13 Mar 2008 22:32:34 +0100
> > To: <user@struts.apache.org>
> > Subject: How to initialize business service objects?
> > 
> > Hi all
> >  
> > i'm just starting with struts2 (even with struts at all). 
> Of course i first
> > read some how-to-starts. But there is one thing i don't understand.
> >  
> > I'm trying to create a simple little chat app. I have two 
> action classes,
> > one for the normal chat user, one for the moderators. Both 
> classes need
> > access to the same instances of business service classes 
> which mainly hold
> > runtime data such as a list of users currently logged in, 
> list of chat rooms
> > and so on.
> >  
> > Now i don't understand (1) where to create/initialize these 
> business logic
> > classes and (2) how to get access to them from the action classes.
> >  
> > I'm very thankful for any hint.
> >  
> > Thanks a lot
> > Frank
> 
> 
> 
> This email and any attachments ("Message") may contain 
> legally privileged and/or confidential information.  If you 
> are not the addressee, or if this Message has been addressed 
> to you in error, you are not authorized to read, copy, or 
> distribute it, and we ask that you please delete it 
> (including all copies) and notify the sender by return email. 
>  Delivery of this Message to any person other than the 
> intended recipient(s) shall not be deemed a waiver of 
> confidentiality and/or a privilege.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


Mime
View raw message