Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Tomcat Problem??

  • 20-03-2003 04:32PM
    #1
    Closed Accounts Posts: 5


    Hi,
    Im getting this error:
    HTTP Status 405 HTTP Method POST is not supported by this URL

    Im trying to run a small JavaMail program from tomcat
    I have the servlet included in the web.xml file
    <servlet>
    ..
    ..
    </servlet>

    <servlet-mapping>
    ..
    ..
    </servlet-mapping>

    Im running many other servlets with the same authority constraints and they work fine. For some reason this servlet wont
    Any ideas??
    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Post the servlet code and the code of whatever is calling it.

    Whats happening is whatever is calling the servlet is using a HTTP Post request to do so, your servlet doesn't support this.


  • Closed Accounts Posts: 5 james_mcgovern


    This is the code
    note: I have tried it with POST and doPost
    the html part is at the bottom of the file


  • Closed Accounts Posts: 202 ✭✭DSLinAbsentia


    The act of simply accessing a servlet from a URL (i.e., http://host/servlet/MyServlet, issues a GET request to that servlet.

    If you're trying to sent data from a form using the GET method, then you need something like this...

    <form method="GET" action="/servlet/MyServlet">
    blah blah
    </form>

    alternatively, if you want your servlet to cover the GET & POST methods, then simply add the following to your servlet class


    public void doPost (HttpServletRequest req, HttpServletResponse res) {
    doGet (req, res);
    }

    Now whatever way your servlet is called it will behave.

    Hope this helps.


Advertisement