0

I need to build a very simple bulletin chat board based on a single Servlet.

The website will include

  1. a landing page (index.html) that displays the current messages.

  2. a second page (composeMsg.html) to compose a message.

The landing page should include a link to the second page.

The landing page will also call the Servlet (http GET) that will retrieve all current messages and display them.

In the compose page, upon submit (http POST), the form data will be processed by the Servlet and stored .

the questions:

  1. How can i call the Servlet (http GET) from the landing page to retrieve all messages and display them? all the examples i saw based on a <form> and a SUBMIT button.. i want that the landing page will display the messages automatically.

  2. In the compose page: how can i display the landing page after the user sends a new message? i know that i can get a new response Writer and send the HTML line by line but it looks unnecessary to me... is there a simple way to do that?

(please do not use javascript)

thanks!

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
daniel
  • 35
  • 1
  • 7
  • Hi, I'm not sure I fully understand your question. Where are your messages stored? In a database? Then the first request is enough to retrieve the data, just use `doGet`in your servlet – Yassin Hajaj Dec 19 '15 at 20:29
  • @YassinHajaj The messages stored in a Vector on the Servlet Class (not DB) and i want that when the user enters the landing page he will see all the current messages. If the user will refresh the page the message list will refresh too. The user should not click on any link to see the messages. – daniel Dec 20 '15 at 07:33

0 Answers0