Its not possible to get java variable inside a script. you can set the values in to a HTML element using java after you have done that you can use  <script> tag to access the values which is in HTML element
    <% String Name="myName"; %>
    <input type="text" name="Name" id="Name"  value="<%=Name%>" maxlength="50" />
using script tag to get the data in html element.
<script>              
    var name = document.getElementById('Name').value;
    <script>
<code> is not a tag used in HTML to write java code. so you cant do any coding inside a code tag anything you will write in there will be just interpreted on browser in the format of a code.
changed the answer according to your comments.example on getting values as a json and converting them to java objects
  String json = "{\"Name\":\"priyamal\",\"Mob\":\"077045\"}";
    ObjectMapper mapperobject = new ObjectMapper();
    Map<String, Object> javaobj = mapperobject.readValue(json, new TypeReference<Map<String,Object>>() { });
    out.println("MyName:" + javaobj.get("Name") + "Mobile:" + javaobj.get("Mob"));