title: How to display String of Json in jsp table
body: <p>I have searched every where, but can't find the help I need.</p>
  
  <p>In my servlet I receive a String containing JSON data. These data are rows from a database and contains this:</p>
  
  <pre><code>[{"note_id":1,"title":"Homework","text":"Math ex. 15, 16, 17.","color":"Yellow","datetime":""}]
  </code></pre>
  
  <p>My problem is that I'm not able to show these data on a html table using jstl.</p>
  
  <p>This is what I get:
  <a href="https://i.stack.imgur.com/4Lz1B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Lz1B.png" alt="enter image description here"></a></p>
  
  <p>(I'm getting stressed and can't figure out how to solve this). </p>
  
  <p>Servlet code (post method):</p>
  
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      .
      .
      .
      String output = resp.getEntity(String.class);
      System.out.println("* JSON string contains:  * " + output); //prints the string with json data successfully
  
      ObjectMapper objectMapper = new ObjectMapper();
      TypeReference&lt;ArrayList&lt;Note&gt;&gt; mapType = new TypeReference&lt;ArrayList&lt;Note&gt;&gt;() {};
      ArrayList&lt;Note&gt; jsonToList = objectMapper.readValue(output, mapType);
  
      request.setAttribute("allNotesOfUser", jsonToList);
  
      RequestDispatcher rd = request.getRequestDispatcher("/Notes.jsp");
      rd.forward(request, response);
  }
  </code></pre>
  
  <p>jsp code (just the table part):</p>
  
  <pre><code>&lt;table class="table table-striped"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt; Id &lt;/th&gt;
                  &lt;th&gt; Title &lt;/th&gt;
                  &lt;th&gt; Text &lt;/th&gt;
                  &lt;th&gt; Color &lt;/th&gt;
                  &lt;th&gt; Date/Time &lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
  
          &lt;tbody&gt;
          &lt;c:forEach items="${allNotesOfUser}" var="pp"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;${pp.note_id}&lt;/td&gt;
                      &lt;td&gt;&lt;${pp.title}&lt;/td&gt;
                      &lt;td&gt;&lt;${pp.text}&lt;/td&gt;
                      &lt;td&gt;&lt;${pp.color}&lt;/td&gt;
                      &lt;td&gt;&lt;${pp.datetime}&lt;/td&gt;
                  &lt;/tr&gt;
          &lt;/c:forEach&gt;
          &lt;/tbody&gt;
  
      &lt;/table&gt;
  </code></pre>
  
  <p>Note entity:</p>
  
  <pre><code>@XmlRootElement
  public class Note {
      private int note_id;
      private String title;
      private String text;
      private String color;
      private String datetime;
  
  
      public Note(int note_id, String title, String text, String color, String datetime){
          this.note_id = note_id;
          this.title = title;
          this.text = text;
          this.color = color;
          this.datetime = datetime;
      }
  
      public Note(){
          super();
      }
  
      public int getNote_id() {
          return note_id;
      }
      public void setNote_id(int note_id) {
          this.note_id = note_id;
      }
  
  
      public String getTitle() {
          return title;
      }
      public void setTitle(String title) {
          this.title = title;
      }
  
  
      public String getText() {
          return text;
      }
      public void setText(String text) {
          this.text = text;
      }
  
  
      public String getColor() {
          return color;
      }
      public void setColor(String color) {
          this.color = color;
      }
  
  
      public String getDatetime() {
          return datetime;
      }
      public void setDatetime(String datetime) {
          this.datetime = datetime;
      }
  
  }
  </code></pre>