Sunday, June 16, 2013

How can you create a cookie after login?

We can create a hook for post login Action

in the action we can create cookie using HttpServletResponse




public class MyLoginPostAction extends Action {

    @Override
    public void run(HttpServletRequest request, HttpServletResponse response)
            throws ActionException {
      
      
       Cookie loginCookie= new Cookie("loginCountry", "DE");
        response.addCookie(loginCookie);
  
 }

}