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](https://stackoverflow.com/questions/5158400/how-to-use-scriptlet-inside-javascript) and tried `'&lt;%=logs;';` but this is displaying `<%=logs%>` but not the value in `logs`.