title: how to use session in grails
body: <p>I am new to grails. And I have to work with session. I have seen the session documentation. But no idea where to put the code in my controller. I have a page for student creation names createStudent. Now I want that this page only be access able when the user will be in session. Now how can I do it. Should I have to set the user in a variable at the time of login. Can anyone please help me on this ? </p>
  
  <pre><code>def index() {
      def user = session["user"]
      if (user){
          redirect(controller: 'admistratorAction', action: 'createUser')
      }else{
          redirect(controller: 'login', action: 'index')
      }
  
  }
  </code></pre>