You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Frans Thamura <fr...@meruvian.org> on 2008/04/30 01:55:20 UTC

Adding Global POJO in S2 Environment

hi all

i just get an idea to make one of my class a POJO will be recognized
globally inside S2 environment

so i get the values from this POJO, such as username, password all across
application

anyone can help, what is the best way to implement this?

F

Re: Adding Global POJO in S2 Environment

Posted by Frans Thamura <fr...@meruvian.org>.
On Wed, Apr 30, 2008 at 7:44 AM, Jim Kiley <jh...@summa-tech.com> wrote:

> Is this something you want to have accessible from your view pages, or
> just
> from your action classes?  For the most part you can deal with this in the
> same way you'd deal with any other singleton or singleton-oid.  Use the
> good
> old static singleton pattern per Josh Bloch et al, or (preferably) use
> Spring to create and inject your POJO wherever you need it.
>


i want to create a global context variable

can give me the glue to create a injected POJO in S2?

so the variable just from resource bundle, and all the struts2 will know the
value inside that

F

Re: Adding Global POJO in S2 Environment

Posted by Wes Wannemacher <we...@wantii.com>.
On Wed, 2008-04-30 at 08:01 +0700, Frans Thamura wrote:
> On Wed, Apr 30, 2008 at 7:51 AM, Wes Wannemacher <we...@wantii.com> wrote:
> 
> > Do you want one static copy of your POJO available everywhere, or do you
> > need a unique copy of your POJO for each request or session?
> >
> 
> i want this pojo available  in my context (only inside current .war).
> 
> i have a generic action support implementation, i use spring, and the aware
> is implement persistance aware
> 
> do i have to implement another persistance aware, and this aware connect to
> the spring + resourcebundle that i want to be injected as global variable
> 
> f

Frans,

This really doesn't answer my question... What I am asking is this - If
I make a POJO -

public class WanTii {
  private String username;
  ...
  getters/setters
}

And, when my app starts up, I create a copy of this POJO and set
username to "wesw." Then assuming this POJO is injected in all actions
(even for other users) getUsername() calls will return "wesw." 

Or, do you want a unique copy of the POJO so that each user will see
their own username?

-Wes


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


Re: Adding Global POJO in S2 Environment

Posted by Frans Thamura <fr...@meruvian.org>.
On Wed, Apr 30, 2008 at 7:51 AM, Wes Wannemacher <we...@wantii.com> wrote:

> Do you want one static copy of your POJO available everywhere, or do you
> need a unique copy of your POJO for each request or session?
>

i want this pojo available  in my context (only inside current .war).

i have a generic action support implementation, i use spring, and the aware
is implement persistance aware

do i have to implement another persistance aware, and this aware connect to
the spring + resourcebundle that i want to be injected as global variable

f

Re: Adding Global POJO in S2 Environment

Posted by Wes Wannemacher <we...@wantii.com>.
Do you want one static copy of your POJO available everywhere, or do you
need a unique copy of your POJO for each request or session?

-Wes

On Tue, 2008-04-29 at 20:44 -0400, Jim Kiley wrote:
> Is this something you want to have accessible from your view pages, or just
> from your action classes?  For the most part you can deal with this in the
> same way you'd deal with any other singleton or singleton-oid.  Use the good
> old static singleton pattern per Josh Bloch et al, or (preferably) use
> Spring to create and inject your POJO wherever you need it.
> 
> jk
> 
> On Tue, Apr 29, 2008 at 7:55 PM, Frans Thamura <fr...@meruvian.org> wrote:
> 
> > hi all
> >
> > i just get an idea to make one of my class a POJO will be recognized
> > globally inside S2 environment
> >
> > so i get the values from this POJO, such as username, password all across
> > application
> >
> > anyone can help, what is the best way to implement this?
> >
> > F
> >
> 
> 
> 


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


Re: Adding Global POJO in S2 Environment

Posted by Jim Kiley <jh...@summa-tech.com>.
Is this something you want to have accessible from your view pages, or just
from your action classes?  For the most part you can deal with this in the
same way you'd deal with any other singleton or singleton-oid.  Use the good
old static singleton pattern per Josh Bloch et al, or (preferably) use
Spring to create and inject your POJO wherever you need it.

jk

On Tue, Apr 29, 2008 at 7:55 PM, Frans Thamura <fr...@meruvian.org> wrote:

> hi all
>
> i just get an idea to make one of my class a POJO will be recognized
> globally inside S2 environment
>
> so i get the values from this POJO, such as username, password all across
> application
>
> anyone can help, what is the best way to implement this?
>
> F
>



-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com