Question

I have global static boolean variable defined in struts-action class. How do i change its value from other Action class.

public class MyAction extends Action{

   public static boolean existsFlag = false;

    public ActionForward execute(ActionMapping mapping,
                            ActionForm actionForm, HttpServletRequest request,
                            HttpServletResponse response)
                    throws Exception
    {
         int a=10;
         if(a==10){
             existsFlag = true; // is this ok to use
         }
         return mapping.findForward("successDisplayForm");
    }

}

Also I have another Action class, where i want to set this value to 'false' when transaction gets completed.

Please help.

Note : Using Struts-1.3

Was it helpful?

Solution

Just like any other public static variable:

MyAction.existsFlag = true / false;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top