title: Spring 3 MVC access Global Variable from Controller
body: <p>I have one public variable in Logincontroller.java, its setting Boolean flag = true for all JSP pages if there are some specific users. </p>
  
  <p>I want to access this Global variable in Header.jsp, how can i do so without using ModelandView because if i use MV i have to change code for all @RequestMapping JSP pages ... I am new to Spring Framework thanks...</p>
  
  <pre><code>public Boolean flag = false;
  
  @RequestMapping(value = "/login.html", method = RequestMethod.GET) 
  public ModelAndView error(HttpServletRequest req, HttpServletResponse res) { 
      ModelAndView mv = new ModelAndView(); 
      ............... 
      if(flag){ // want to avoid doing this for each pages 
          mv.addObject("specialUser", true); // want to avoid doing this for each pages 
      } 
      return mv 
  }
  </code></pre>
  
  <p>same way i have multiple @RequestMapping for different pages like /admin, /user, /index ,etc</p>