I have a login servlet that takes values from a login html file and redirects immediately to sessiondemo.html. 

```
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

  public class logIn extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res)
                      throws ServletException, IOException {

      res.setContentType("text/html");
      PrintWriter out = res.getWriter();
      HttpSession session = req.getSession(true);

      //getting the value(s) from HTML
      String fname = req.getParameter("fname");
      String lname = req.getParameter("lname");
      String email = req.getParameter("email");
      String address = req.getParameter("address");

      //Storing the values in Session
      session.setAttribute("FirstName", fname );
      session.setAttribute("LastName", lname );
      session.setAttribute("Email", email);
      session.setAttribute("address", address);

      res.sendRedirect("http://localhost:8080/apps/sessiondemo.html");
      out.close(); 
    }
  }

```

What I cant figure out is, I want to display the first and last name in the sessiondemo html. I know the code has to be written in the seesiondemo html but it is not working.

Here is what I tried:

```
<% session.getAttribute("FirstName", fname);
        out.println("You are logged in as" + fname + "!");%>

```

XML files

```
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <description>Test examples</description>
  <display-name>My Servlets</display-name>

 <servlet>
  <servlet-name>GET</servlet-name>
  <servlet-class>GET</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>GET</servlet-name>
  <url-pattern>/GET</url-pattern>
</servlet-mapping>

 <servlet>
  <servlet-name>POST</servlet-name>
  <servlet-class>POST</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>POST</servlet-name>
  <url-pattern>/POST</url-pattern>
</servlet-mapping>

 <servlet>
  <servlet-name>Cart</servlet-name>
  <servlet-class>Cart</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>Cart</servlet-name>
  <url-pattern>/Cart</url-pattern>
</servlet-mapping>

<servlet>
  <servlet-name>logIn</servlet-name>
  <servlet-class>logIn</servlet-class>
</servlet>
<servlet-mapping>
  <servlet-name>logIn</servlet-name>
  <url-pattern>/logIn</url-pattern>
</servlet-mapping>

</web-app>

```