We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,459 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Loading comments from a databse on page load

I have a jsp page which has post comment box. I have written a servlet which takes a comment from the text area for the comment box and writes the comment to the database and redirects all the comments stored in the database to the page for display(using request dispatcher). The new comment displays along with all the previous comments. I want to have a functionality where the previous comments are displayed on page load by connecting it to the database . How can I accomplish this.

2
Contributors
1
Reply
4 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
rohit_static
Newbie Poster
6 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

if you already have a page that displays all the comments then the question is not "how" but "where" no?

simply reuse that code in the first page! :)
unless im not understanding right what you were saing in your question, but anyways.

In your page, simply have a section call the database functions to execute a SELECT statement on all comments, then loop through the comments and display them in your page!

Philippe.Lahaie
Posting Whiz
360 posts since Oct 2007
Reputation Points: 103
Solved Threads: 54
Skill Endorsements: 4

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0548 seconds using 2.71MB