I got an arrayList
of BlogPosts
and I want to show the content of the objects on screen.
I read my ArrayList
from the ServletContext
with this output:
[com.example.week3.BlogPost@58d100c8, com.example.week3.BlogPost@5baade52]
Where and how do I read the content of this?
This is my BlogPost class:
package com.example.week3;
import java.io.Serializable;
public class BlogPost implements Serializable{
private String blogtext;
public BlogPost(String bt) {
blogtext = bt;
}
public String getBlogtext() {
return blogtext;
}
}
This is where I store my List
Object o = getServletContext().getAttribute("blogpost");