Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have global static boolean variable defined in struts-action class. How do i change its value from other Action class.

Java
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
Posted
Updated 13-May-14 0:14am
v3
Comments
Shubhashish_Mandal 15-May-14 3:26am    
By MyAction.existsFlag. To access any static variable you can call it using its class name.
However instead using global variable set this flag in request/session/application scope as per your need.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900