I'm making a dynamic web project in Eclipse and cannot figure out how to send the result of the query to a jsp file.
This is the servlet doGet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
String name = session.getAttribute("user").toString();
String query = "SELECT DISTINCT t.text, t.user, t.date"
+ " FROM users u, tweets t, follows f"
+ " Where t.parent is null"
+ " AND u.id ='"+name + "'"
+ " AND ( f.follower = u.id"
+ " AND f.followed = t.user"
+ " OR t.user = u.id)"
+ " ORDER BY t.date DESC;";
try {
ResultSet rs = Dao.executeQuerySQL(query);
while (rs.next()){
//Get all tweets -> THIS IS THE INFO I WANT TO RETRIEVE
rs.getString(1);
}
}
and this is the timeline.jsp:
<script>
$(document).ready(function(){
});
</script>
This is the timeline!
How I can retrieve here in the jsp the information?
Thanks in advance.