Hi I could get my session values in my jsp, now I want to compare the session value whether it matches the textbox, if it matches, it will redirect the user to another page else it will remain the same page, I am not sure how to proceed, please help . Much thanks!
JSP
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Factorial</title>
</head>
<body>
<form action="fact" method="POST">
Enter a number: <input type="text" name="num">
<input type="submit"/>
<%= session.getAttribute( "money" ) %>,
</form>
</body>
</html>
Servlet
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    HttpSession session = request.getSession();
         String text = request.getParameter("money");
         int money = (Integer)session.getAttribute("money");   
         String testing = String.valueOf(money);
    if(text == testing)
    {
    RequestDispatcher rd = request.getRequestDispatcher("MainPage");
    rd.forward(request, response);
}
else
{
  response.redirect("Errorpage.jsp");
}
 
    