wood burning stoves 2.0*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "405 error" Watch "405 error" New topic
Author

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) {
e.printStackTrace();
} catch (IOException e) {

e.printStackTrace();
}

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")) {
response1.sendRedirect("http://www.ynet.il");
}

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
Bartender

Joined: Nov 08, 2003
Posts: 3476

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
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2885
    
  13

Please UseCodeTags


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
My Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
le zhng
Greenhorn

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
 
 
subject: 405 error
 
Similar Threads
get DB information parameters
in which method shuld i use at the servlet code for request
getting null value from radio button
Can Someone help me out?
Pass radio button to servlet