It's not a secret anymore!
The moose likes Servlets and the fly likes 405 error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "405 error" Watch "405 error" New topic

405 error

alona ariel
Ranch Hand

Joined: Sep 09, 2008
Posts: 36
I have a problem with my programm

my program is: <form action=TestUser3 METHOD="post">

<input type="radio" name="kaspomat" value="a1" >
radio button 1

<input type="radio" name="kaspomat" value="a10" >
radio button 2

and servlet: */
public void doPost(HttpServletRequest request1, HttpServletResponse response1) throws ServletException, IOException {{

try {
super.doPost(request1, response1);
} catch (ServletException e) {
} catch (IOException e) {


doPost1(request1, response1, null);

void doPost1 (HttpServletRequest request1, HttpServletResponse response1, Object object)throws ServletException,IOException {

try {
if(request1.getParameter("radios") != null) {

if(request1.getParameter("radios").equals("a1")) {

javax.servlet.RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/indexa1.jsp");
rd.forward(request1, response1);


if(request1.getParameter("radios").equals("a10")) {

when I run this programm I get: HTTP Status 405 - HTTP method POST is not supported by this URL

please someone can tell me why it happen? what the problem with my program?

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Please format your code and put some comments to indicate where every thing begins and ends.
You are calling super.doPost() , aren't you are supposed to call your doPost1() ?
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3927

Please UseCodeTags

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
le zhng

Joined: Mar 23, 2010
Posts: 1
Your servlet Java extends HttpServlet . Normally, we only need to rewrite the doPost or doGet method to deal with the "get" or "post" in the form.There'are so rules to obey while naming the function.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
The default doPost implementation in HttpServlet put 405 error code in response. Since you are calling default impl from your doPost implementation so you getting it in your response. Nothing strange!

SCJP 1.5(97%) My Blog
I agree. Here's the link:
subject: 405 error
It's not a secret anymore!