I was asked to display a cookie that was created in a register.java page to a jsp page that is displayed when a user has registered.

Basically the value of the cookie should display after "Welcome: "

The problem is that every single method I try has some kind of screw up because it's not exactly what's needed.

I have had a really ****ty life lately and can't get my head around this. Would appreciate some help.

The error I'm getting is that it wont find the "Cookiename".getValue()

The method of putting it in the page that I googled wont work. It wont work with a useBean either.

Here's the code:

Code:
package download;

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

import business.User;
import data.UserIO;

public class RegisterUserServlet extends HttpServlet
{    
    public void doPost(HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException
    {      
        String firstName = request.getParameter("firstName");
        String lastName = request.getParameter("lastName");
        String emailAddress = request.getParameter("emailAddress");
        
        User user = new User();
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setEmailAddress(emailAddress);

        ServletContext sc = getServletContext();
        String path = sc.getRealPath("WEB-INF/EmailList.txt");

        UserIO.add(user, path);
        
        HttpSession session = request.getSession();
        session.setAttribute("user", user);
        String productCode = (String) session.getAttribute("productCode");
        
        Cookie emailCookie = new Cookie("emailCookie", emailAddress);
        emailCookie.setMaxAge(60*60*24*365*2); //set its age to 2 years
        emailCookie.setPath("/"); //allow the entire application to access it
        response.addCookie(emailCookie);
        
        Cookie fnameCookie = new Cookie("fnameCookie", firstName);
        fnameCookie.setMaxAge(60*60*24*365*2); //set its age to 2 years
        fnameCookie.setPath("/"); //allow the entire application to access it
        response.addCookie(fnameCookie);
        
        String url = "/" + productCode + "_download.jsp";
        RequestDispatcher dispatcher =
            getServletContext().getRequestDispatcher(url);
        dispatcher.forward(request, response);        
    }
}
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Murach's Java Servlets and JSP</title>
</head>
<body>

<h1>List of albums</h1>

<p>
  <%@ page language="java" import="business.User"%>
  <%@page import="RegisterUserServlet"%>
  
   Welcome: <%= fnameCookie.getValue() %>
    
<a href="<%=response.encodeURL("checkUser?productCode=8601")%>">
    86 (the band) - True Life Songs and Pictures
</a><br>

<a href="<%=response.encodeURL("checkUser?productCode=pf01")%>">
    Paddlefoot - The first CD
</a><br>

<a href="<%= response.encodeURL("checkUser?productCode=pf02")%>">
    Paddlefoot - The second CD
</a><br>

<a href="<%= response.encodeURL("checkUser?productCode=jr01")%>">
    Joe Rut - Genuine Wood Grained Finish
</a>
</p>

</body>
</html>