My problem is that I want to redirect to my index page without having to see the attributes appended in the URL.

I found the solution to be `addFlashAttributes`, it doesn't append attributes in the URL but I can't see any message saved by this method.

**Code:**

**Controller**

```
@RequestMapping(value="/login",method = RequestMethod.POST)  
public ModelAndView loginResult(HttpServletRequest req,
                                HttpServletResponse res,
                                RedirectAttributes redir) {
    if (uname.equals(inf.getUsername()) & &pwd.equals(inf.getPassword()) && dept.equals(inf.getDept()))
    {
        req.getSession().setAttribute("uname",inf.getName());
        return new ModelAndView("employeeLoginResult", "message", message1); 
    }
    else if (uname.equals(inf2.getUsername()) && pwd.equals(inf2.getPassword()) && dept.equals(inf2.getDept()))
    {
        req.getSession().setAttribute("uname", inf2.getName());
        return new ModelAndView("adminLoginResult", "message", message2); 
    }
    else
    {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("redirect:/index.jsp");
        redir.addFlashAttribute("message","Sorry Username Password Error");
        return modelAndView;
    }
}

```

Right now I have hardcoded values for validation and would integrate the validation with DAO layer of database in the future. The `addFlashAttribute` does the work for me of not appending the message to the URL, but I also want to display the message on the index page.

**Index page**

```
<head><tile>index</title>
</head>
<body>
    <b><span class="heading">LOGIN USER</span></b>
    <div class="container">
        <form action="login.html" method="Post">
            <div class="form_style">
            <input type="text" name="username" placeholder="Enter Username"/>
            <input type="password" name="pwd" placeholder="Enter password"/>
            <select name="dept">
                <option>IT</option>
                <option>Admin</option>
                <option>HR</option>
                <option>Marketing</option>
            </select>
            <input type="Submit" value="submit">
            <p>${message}</p>
            </div>
        </form>
    </div>
</body>

```

What am I doing wrong? Can anyone explain? 

Why is `${message}` not displaying the attribute?

Any help is appreciated. Thanks for the same.