Purva Khankary
Purva Khankary

Reputation: 1

jsp exception while converting arraylist to jsp array

<script>
  var availableTags = [
    <% for (int i = 0; i < ApplicationName.size(); i++) { %>
      <%= ApplicationName.get(i) %>
      <%= i + 1 < ApplicationName.size() ? ",":"" %>
    <% } %>
  ];

  $(function() {
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  });

  function value()
  {
    alert(document.getElementById('tags').value);
    var a=document.getElementById('tags').value;
    return a;
  }
</script>

It gives me below error:

Struts has detected an unhandled exception:

Please tell where am I going wrong.

Upvotes: 0

Views: 40

Answers (1)

Brijesh Bhatt
Brijesh Bhatt

Reputation: 3830

You may try putting the following in quotes:

<%= "'"+ApplicationName.get(i)+"'" %>

Upvotes: 1

Related Questions