You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by newtostruts struts <ne...@yahoo.com> on 2007/05/17 13:59:25 UTC
Init methods in Struts
I want to initialize torque in Struts2. I've got the code to initialize torque and it works fine.
The problem is where do I put that code.
Is there a place like an init method which is called just once?
Thx all for your help.
Vinod
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
Re: Init methods in Struts
Posted by newtostruts struts <ne...@yahoo.com>.
Dave,
That works great. Thank you so much.
Dave Newton <ne...@yahoo.com> wrote:
--- newtostruts struts wrote:
> Could you please explain the ' context listener '
> method you follow.
First one I found:
http://www.stardeveloper.com/articles/display.html?article=2001111901&page=1
(Also has stuff about session listeners, but you can
ignore that.)
d.
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
Re: Init methods in Struts
Posted by Dave Newton <ne...@yahoo.com>.
--- newtostruts struts <ne...@yahoo.com> wrote:
> Could you please explain the ' context listener '
> method you follow.
First one I found:
http://www.stardeveloper.com/articles/display.html?article=2001111901&page=1
(Also has stuff about session listeners, but you can
ignore that.)
d.
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Init methods in Struts
Posted by newtostruts struts <ne...@yahoo.com>.
Dave,
I don't really have any preferrence at this time, I'll use anything that'll work :o)
Could you please explain the ' context listener ' method you follow.
Thx
Dave Newton <ne...@yahoo.com> wrote:
--- newtostruts struts wrote:
> newtostruts struts wrote: I
> want to initialize torque in Struts2. I've got the
> code to initialize torque and it works fine.
> The problem is where do I put that code.
> Is there a place like an init method which is called
> just once?
Personally I've always used (well... you know what I
mean) a context listener to do one-time app
initialization (and startup servlets before that).
I don't really see any reason to not do the same with
S2, I suppose, although I'll be interested with what
other people are doing.
(I used to use Torque, too... at the time it seemed
like a pretty good choice to me. I don't any more, but
I had great success with it.)
d.
____________________________________________________________________________________Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
Re: Init methods in Struts
Posted by Dave Newton <ne...@yahoo.com>.
--- newtostruts struts <ne...@yahoo.com> wrote:
> newtostruts struts <ne...@yahoo.com> wrote: I
> want to initialize torque in Struts2. I've got the
> code to initialize torque and it works fine.
> The problem is where do I put that code.
> Is there a place like an init method which is called
> just once?
Personally I've always used (well... you know what I
mean) a context listener to do one-time app
initialization (and startup servlets before that).
I don't really see any reason to not do the same with
S2, I suppose, although I'll be interested with what
other people are doing.
(I used to use Torque, too... at the time it seemed
like a pretty good choice to me. I don't any more, but
I had great success with it.)
d.
____________________________________________________________________________________Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Init methods in Struts
Posted by "Zhang, Larry (L.)" <lz...@ford.com>.
Then I have no clue other than newton.dave's approach ...
-----Original Message-----
From: newtostruts struts [mailto:newtostruts@yahoo.com]
Sent: Thursday, May 17, 2007 2:46 PM
To: Struts Users Mailing List
Subject: RE: Init methods in Struts
Larry thanks for the reply.
I'm in Struts2 mode and I don't see a PlugIn interface anywhere.
Also, I read this on apache site ' Struts 1 provides a plugin class
that provides listener-like capabilities. The Struts 2 plugins are like
Eclipse or FireFox plugins, and not at all like Struts 1 "plugins". '
Any other alternatives ?
"Zhang, Larry (L.)" <lz...@ford.com> wrote:
Try this:
in struts-config.xml put this
And then define YourPlugin as:
...
import org.apache.struts.action.PlugIn;
public class YourPlugin implements PlugIn {
public void destroy() {
// holder for things to do
}
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
// init your torque
}
}
When you start the server, Torque should be initialized. Let me know if
this works.
-----Original Message-----
From: newtostruts struts [mailto:newtostruts@yahoo.com]
Sent: Thursday, May 17, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Init methods in Struts
Anyone please...
newtostruts struts wrote: I want to initialize
torque in Struts2. I've got the code to initialize torque and it works
fine.
The problem is where do I put that code.
Is there a place like an init method which is called just once?
Thx all for your help.
Vinod
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who
knows.
Yahoo! Answers - Check it out.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Init methods in Struts
Posted by newtostruts struts <ne...@yahoo.com>.
Larry thanks for the reply.
I'm in Struts2 mode and I don't see a PlugIn interface anywhere.
Also, I read this on apache site ' Struts 1 provides a plugin class that provides listener-like capabilities. The Struts 2 plugins are like Eclipse or FireFox plugins, and not at all like Struts 1 "plugins". '
Any other alternatives ?
"Zhang, Larry (L.)" <lz...@ford.com> wrote:
Try this:
in struts-config.xml put this
And then define YourPlugin as:
...
import org.apache.struts.action.PlugIn;
public class YourPlugin implements PlugIn {
public void destroy() {
// holder for things to do
}
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
// init your torque
}
}
When you start the server, Torque should be initialized. Let me know if
this works.
-----Original Message-----
From: newtostruts struts [mailto:newtostruts@yahoo.com]
Sent: Thursday, May 17, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Init methods in Struts
Anyone please...
newtostruts struts wrote: I want to initialize
torque in Struts2. I've got the code to initialize torque and it works
fine.
The problem is where do I put that code.
Is there a place like an init method which is called just once?
Thx all for your help.
Vinod
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who
knows.
Yahoo! Answers - Check it out.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
RE: Init methods in Struts
Posted by "Zhang, Larry (L.)" <lz...@ford.com>.
Try this:
in struts-config.xml put this
<plug-in className="com....YourPlugin">
</plug-in>
And then define YourPlugin as:
...
import org.apache.struts.action.PlugIn;
public class YourPlugin implements PlugIn {
public void destroy() {
// holder for things to do
}
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
// init your torque
}
}
When you start the server, Torque should be initialized. Let me know if
this works.
-----Original Message-----
From: newtostruts struts [mailto:newtostruts@yahoo.com]
Sent: Thursday, May 17, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Init methods in Struts
Anyone please...
newtostruts struts <ne...@yahoo.com> wrote: I want to initialize
torque in Struts2. I've got the code to initialize torque and it works
fine.
The problem is where do I put that code.
Is there a place like an init method which is called just once?
Thx all for your help.
Vinod
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who
knows.
Yahoo! Answers - Check it out.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Init methods in Struts
Posted by newtostruts struts <ne...@yahoo.com>.
Anyone please...
newtostruts struts <ne...@yahoo.com> wrote: I want to initialize torque in Struts2. I've got the code to initialize torque and it works fine.
The problem is where do I put that code.
Is there a place like an init method which is called just once?
Thx all for your help.
Vinod
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.