title: Accessing Servlet Response Attributes With Javascript/Jquery
body: <p>I am using Java servlets with Tomcat to display a table of Places in HTML. The data in the table's rows consists of info like name, location, etc. and are obtained by taking the servlet response data and injecting it into the  tags. Once this is done however, I need to use Javascript to manipulate the "td" elements based their values. So if one of the locations which went into a "td" element was "USA," my Javascript function would do something specific to the "USA" element, like make the surrounding border red, white and blue.</p>
  
  <p>I do not want to send a request using $.ajax. I simply want to, within the scope of a script element, access the attributes returned by the servlet response like I do in the following way with JSP scriptlets</p>
  
  <pre><code>&lt;% request.getAttribute("location"); %&gt;
  </code></pre>
  
  <p>I'm kind of surprised I haven't found how to do this online because it seems like an daily action of anyone working with servlets and JS, but I've searched on SO and Google to no avail.</p>