Hi All,
We are using weblogic7.1 struts 1.0 version.We are storing all application specific 
parameters in web.xml file.Hence in order to get that value we use following code in 
each action class :
getServlet().getInitParameter("INIT_PARAM")

Instead of this what I thought is we can have a common Parent action class which would 
load all this paramters and store them as it's attributes.
eg.

public class ParentAction extends DispatchAction
{
protected String INIT_PARAM = "";
public ParentAction ()
{
     INIT_PARAM = 
getServlet().getInitParameter("INIT_PARAM");
}
}

Other action classes would extend this class instead of extending DispathAction class 
directly.
But when I try to get the value of init param in subclasses of parent action class it 
gives me an error.

public class LoginAction extends ParentAction 
{
     public ActionForward log(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception, 
IOException, ServletException {
      System.out.println(INIT_PARAM);      //gives NullPointerException

}

}
I would like to know whether above logic is valid if no is there any other workaround?

Regards,
Shakti

Reply via email to