Solved

Error : "Get or Post is not supported"

Posted on 2001-06-25
4
151 Views
Last Modified: 2013-11-24
hi experts,
 The following servlet is giving an error similar to this
  "Errror 400   GET or POST is not supported by this URL "

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet
{
     public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
     {
          PrintWriter out = res.getWriter();
          out.println("Hello World");
     }
I compiled the servlet and saved it in the 'Examples' directory of JSDK2.0.. then I called the servlet by giving "http://127.0.0.1:8080/servlet/HelloWorld"
     pls comment
 regs pvraj
}
0
Comment
Question by:pvraj
  • 2
4 Comments
 
LVL 3

Expert Comment

by:dnoelpp
Comment Utility
You should put the servlet class inside the subdirectory WEB-INF/classes of the Examples directory.

The idea is that the Webserver loads all servlet classes from two additional places:

1. WEB-INF/classes
2. WEB-INF/lib/*.jar

No need to set the classpath.
0
 
LVL 9

Accepted Solution

by:
mmuruganandam earned 50 total points
Comment Utility
If you are using the jws then place this class in the

servlets directory and try.  The code is perfect.

you can use the localhost also.



All the best

Cheers,
Muruganantham
0
 

Author Comment

by:pvraj
Comment Utility
i m using LWS-2.2.1 SERVER
regs
0
 

Author Comment

by:pvraj
Comment Utility
when i place the servlet in the servlets directory of lws , it is working .. thanx
regs
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now