This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

405 error  RSS feed

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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() ?
 
Marshal
Posts: 5923
874
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!