I need to try and read a value from one JSP file in another. I came across a forum while searching or an answer and found that if I declare a variable in one file and include that JSP file in the new one. So, that's what I tried but am getting a null value on my second JSP file.
JSP1:
<% String value =(String)request.getAttribute("loggedIn"); %>
"loggedIn" is a value returned from a java servlet and when i use the variable value in this page it outputs the correct result.
JSP2:
<%@include file="JSP1.jsp"%>
<div id="navbar">
<div id="logo">
<img SRC="logo.png" ALT="Unable to load image" WIDTH=150 HEIGHT=90>
</div>
<div id="navbar-right">
<a style="margin-right:20px;border-radius: 0px;background-color:#c1d6a7"><%=value%></a>
<a class="active" href="Login.jsp">Logout</a>
<a href="ViewData.jsp">View Data</a>
</div>
</div>
using this method, the <%=value%>
gives a null value.