I got a error as "HTTP Status 405 - HTTP method POST is not supported by this URL" .. i shuffled by changing the methods between get and post but both yielded the same error. I saw lot of blogs and tried to make changes as per the people comments but ended up with the same result. Kindly, help me out. I have just pasted the code below.
You'll likely find the info you need here. Yes, the error code is different, but the causes are similar.
Hint: Packages are important, and so is letter-case.
btw, "servlet" is a poor name choice for a servlet. Use a descriptive name that tells you something about what the servlet does, even if it's just "/MyHelloWorldServlet".
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Change the Welcome.html like this
</head>
<body>
<form action="servlet" method="post">
User Name:<input type="text" name="uname">
<input type="submit" value="Submit">
</form>
</body>
</html>
I doubt that that change alone solved anything. I advise to familiarize yourself with the @Override annotation, and use that whenever you think you're overriding a method. it's a real time saver.
Besides, treating GET and POST interchangeably violates the HTTP specification, and you may well run into problems.
And lastly, you need to get into the habit of putting your classes into packages. It won't be long until you'll run into trouble if you don't.
What's that smell? I think this tiny ad may have stepped in something.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth