struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andvar Woo" <andvar2...@gmail.com>
Subject Re: How to make initialize with struts2 action?
Date Thu, 16 Aug 2007 07:13:40 GMT
I tested it,it works fine. Note that static block can only refer to static
fields and static methods
Don't put the static block in any method, just put it alone like a function.

2007/8/16, red phoenix <rodphoenix@gmail.com>:
>
> static
> {
> //doSomeInit,this only run once
> }
>
> above code can't run in struct2 action,it will say "can't use in
> non-static
> class"
>
> I use Struts2+spring2.1+hibernate3.2,I am puzzled with it for many many
> days! I am looking for an example,but I don't find it,would you give me an
> example project which can run under tomcat6?
>
>
> On 8/16/07, Nils-Helge Garli <nilsga@gmail.com> wrote:
> >
> > So you're using Spring? In that case, maybe parts of this tutorial can
> > help: http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html
> >
> > And here's the documentation for the Spring-plugin:
> > http://struts.apache.org/2.x/docs/spring-plugin.html
> >
> > Nils-H
> >
> > On 8/16/07, red phoenix <rodphoenix@gmail.com> wrote:
> > > I know your meaning,but the question I want to Initialize in struts
> > > action,not in common class,because I want to get WebApplicationContext
> > in
> > > struts action,and then I will transfer WebApplicationContext into dao
> to
> > get
> > > data. I don't know if there is a init method in struts2 action?
> > > Any idea will be appreciated!
> > >
> > >
> > > On 8/16/07, Leonidas Papadakis <it@creteonline.gr> wrote:
> > > >
> > > > I think you can use the setters after you initialize your class
> > > > i.e.instead of
> > > > MyType mt = new MyType(...parameters.......);
> > > > to do :
> > > > MyType mt = new MyType();
> > > > mt.setParam1()....
> > > > e.t.c. I am not exactly sure if this is what you are after
> though....
> > > > Why do you want to do this ?
> > > >
> > > > Leon
> > > >
> > > > red phoenix wrote:
> > > > > If I use no-argument constructor,how can i do to initialize some
> > > > > information?
> > > > > Thanks
> > > > >
> > > > >
> > > > > On 8/16/07, Rec Floyd <rec.floyd@gmail.com> wrote:
> > > > >
> > > > >> Hey,red.In my opinion, to use struts, you have to supply a
> > no-argument
> > > > >> constructor.That is the point.
> > > > >>
> > > > >>
> > ---------------------------------------------------------------------
> > > > >> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message