New to JavaEE, need help on doGet() and doPost()

#1
Hi all,
I'm writing a basic codes in javaEE, when I added these codes to doGet()


PrintWriter out = response.getWriter();
out.println("<html><body><h1>The square root of 4.0 is: " + Math.sqrt(4.0) + "</h1></body></html>");


Eclipse will print out something, like "The square root of 4.0 is 2.0", but when I add these to doPost(), Eclipse print out nothing.
Please tell me why, and in what case we use doGet() or doPost()? As I know doGet() and doPost is similar, but doGet() is not safe(password...) and very limited while doPost() is more powerful. Please tell me when to use doGet() and when to use doPost().
Thank you very much!
 
Top