• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

405 error

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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() ?
 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic