-none- 2007-08-15 - By meisam sarabadani
Back Does anybody know how to configure struts on eclipse and build anew project by struts in eclipse ?
On 8/16/07, red phoenix <rodphoenix@(protected)> wrote: > > For general Java class,we can make construction function,like this: > public class test{ > String a; > public test(String a){ > this.a=a; > } > } > > I don't know if I can do it like above code under struts2 action,for some > reason,I want to initialize some variable and assign some value to it,like > follows: > public class MyClass extends ActionSupport{ > private ....; > public MyClass(SomeType s){ > //make some common operaction,such get session and so on,because I > want to run them only once > } > public String execute() throws Exception { > .... > } > public String .....{ > } > ... > } > > I can successly compile above code,but when I run above code,it will say > error: > 1)MyClass action error > 2)java.lang.NullException because some code in MyClass(SomeType s) > > When I remove the code in the MyClass(SomeType s) into execute() > function,it > can run well. I am puzzle with it! Anybody could tell me how to do > it? An > example is better. > > Thanks, > phoenix >
-- Appreciated much,
Meisam Sarabadani IBM Student Ambassador Vice president II, IT Society Multimedia University, Cyberjaya Capmus -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- "The day the Lord created hope was probably the same day he created Spring." Bern Williams. -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
|
|