my dog learned polymorphism*
The moose likes Servlets and the fly likes Servlet question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet question" Watch "Servlet question" New topic
Author

Servlet question

Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
Hi,
I was going through 'Wrox Professional Server programming- Part 1'.
Had the following question with respect to the Chat servlets example mentioned there.
I have a servlet that displays an HTML form. This form contains two text fields in which we enter the name of the chat room and its description.
On submitting the form, this must go to ChatRoom.java which is a jar file already ready in Tomcat-- (lib subdirectory).
ChatRoom.java adds a new chat room to its stack.
My questions were-
Do I need to have both doGet() and doPost() in my servlet?
I had some blank spaces in my HTML form. How do I fill up the gaps, for example form action?
Where will I include code for servlet to pass chatroom name and chatroom description to ChatRoom.java? What will the code look like?
public void doGet(...........)
{
out.println("<HTML>");
out.println("<FORM METHOD=Post Action=________________>");
form is displayed with 2 text fields.
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet question