I think there are 2 cases:
1. you need a param that is available to the Servlet and is not uniquie to any particular Action for eample in my application users can uppload images, so after the upload I store them in a subfolder in the application. here is how I do it:
               a. this snippet I add in web.xml in <servlet> tag
              <init-param>
                   <param-name>imagesstorage</param-name>
                   <param-value>store_images</param-value>
               </init-param>
b. here is the code to get the param in one of the actions (in fact I do this in one plugin because this path is constant all the time, so I read it only on startup)
                       StringBuilder path = new StringBuilder();
path.append(servlet.getServletConfig().getServletContext().getRealPath("/")); path.append(servlet.getServletConfig().getInitParameter("imagesstorage"));


2. every separate Action needs some initial parameter.
In this case why do you need to put as an init param? it's enough just to have static field in the Action class ...

I hope this is usefull for you.

Borislav



For traditional servlets, you can set init parameters
in the web.xml and read it in a static init method in
servlet class. Can I have similar things for action?
If I need some of these init parameter for my web app,
what is the best way to do it with struts?

Thansk,



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--

Mit freundlichen Grüßen

Borislav Sabev

eventsoft GmbH Max-Planck-Str. 3
85716 Unterschleißheim
Tel: 089 - 35 89 03 21
Fax: 089 - 35 89 03 70

[EMAIL PROTECTED]
www.eventsoft.de


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to