• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts: how to pass init params

 
Michael Sweeney
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More appropriate for the Struts forum. Moved.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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")).
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic