I want to access values on JSP in Javascript as follows,
<%String logs = (String)request.getAttribute("logs");
String errlog = (String)request.getAttribute("ErrLogs");%>
<script type='text/javascript'>
$( "#logopt" ).change(function() {
if($("#logopt option:selected").text()=="Complete Log")
{
alert("hi");
document.getElementById("box").innerHTML += '<%=logs%>';
}
});
but this displays nothing, what is my mistake? what is the correct method to access JSP values using scriptlets?
I've referred this answer and tried '<%=logs;';
but this is displaying <%=logs%>
but not the value in logs
.