0

I have a simple servlet where I am setting an attribute and when I try to get the same in JSP, I am getting the static content and not the dynamic data in JSP page.

Servlet

....
request.setAttribute("auditLog",auditLogs.get(1));
RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
rd.forward(request, response);

JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
    
<html>
<body>
<h2>Enter user's email here</h2>

    <form action="getUserData">
      <input type="email" name="email"/>
      <input type = "submit" value="Submit"/>
    </form>
    
    
    <br>
    
The audit logs here


    ${auditLog}
    ${auditLog.getAuditLogId()}

    
    <c:out value="${auditLog}"/>
    
    
</body>
</html>

OUTPUT

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sandeep Amarnath
  • 5,463
  • 3
  • 33
  • 43

1 Answers1

0

This worked after setting <%@ page isELIgnored="false" %> at the top of my jsp page.

Reference : Expression Language in JSP not working

Sandeep Amarnath
  • 5,463
  • 3
  • 33
  • 43