• 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

Error 405 -Http method get not supported by this url

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am learning JSP and i have Apache tomcat 4.1 on my machine. i had been able to compile and run servlets successfuly. i get this error while practising DIRECTIVES.

code for JSP:

<%@ page extends="usingjsp.jspSuperclass" %>
<html>
<body>
i a asubclass extending the superclass
this is a msg form my superclass : <br>
<%= request.getAttribute("demo") %>
</body>
</html>

code for servlet:
package usingjsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public abstract class jspSuperclass extends HttpServlet implements HttpJspPage
{
public final void init(ServletConfig config) throws ServletException
{
super.init(config);
jspInit();
}

public final void destroy()
{
super.destroy();
jspDestroy();
}

public final ServletConfig getServletConfig()
{
return super.getServletConfig();
}

/*public final void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException,java.io.IOException
{
super.service(request,response);
} */

public final void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, java.io.IOException
{
super.service(req,res);
req.setAttribute("demo","Hi from the superclass");
_jspService(req,res);
}

public void jspInit()
{
}

public void jspDestroy()
{
}

public abstract void _jspService(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,java.io.IOException ;
}

the location of jsp is: apache group\tomcat 4.1\root\nfiles\pagdir.jsp
location for servlet is: apache group\tomcat 4.1\root\nfiles\jspSuperclass.java
the compiled file jspSuperclass.class is present in both the nfiles\usingjsp folder as well as root\webapps\web-inf\classes folder.
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not sure about apache tomcat 4.x, I guess it works the same. For me using version 5.0.28 I needed to do the following

Override the doGet method of HttpServlet - remmeber this method if not overridden will give you the error you got by default.
so here is the code I added to JspSuperclass


I then had to restart tomcat and presto it worked.

HTH

Mat
 
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic