File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts: how to pass init params Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts: how to pass init params" Watch "Struts: how to pass init params" New topic

Struts: how to pass init params

Michael Sweeney

Joined: Nov 01, 2004
Posts: 5
Now that everything's running nicely under ActionServlet, how does one pass a simple init param to the execute() in an Action extension ?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

More appropriate for the Struts forum. Moved.

[Asking smart questions] [About Bear] [Books by Bear]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The Action class which you are extending has a getServlet() method that allows you to get a reference to the ActionServlet instance. From there, you can get an init parameter in the same way you would with any servlet (getServletConfig().getInitParameter("xyz")).

Consultant, Sima Solutions
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I have to admit that I do not know what you are asking. Action extension? A class derived from Action or maybe you are talking about a custom class derived from ActionMapping???

- Brent
I agree. Here's the link:
subject: Struts: how to pass init params
It's not a secret anymore!