aspose file tools*
The moose likes Servlets and the fly likes servlet problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet problem" Watch "servlet problem" New topic
Author

servlet problem

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 613
Hi ,
The servlet I am trying to compile must 3 or 4th but I am getting the same problem evertime I try to access any Servet.
sometimes I get the following Error:
HTTP Status 405 - HTTP method GET is not supported by this URL
--------------------------------------------------------------------------------
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
or the below error
Error 505..which says the context is not configured for the application hence it can not process the request.
In one of the sample servlet I am trying to access the html form that also it's not able to process.
On my machine I am not using the local host instead i use the Ip address of my machine.
i am saving all the servlet class files unser install-dir/webapps/root/WEB-INF/classes directory but the .java files are under different dirctory . I have configured the classpath corrctly also i get the default server page correctly.
can someone let me know what is the problem?
thanks in advance.
trupti
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
Have you implement the doGet() method in your servlet?
trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 613
Hi,
below is the servlet code.this is from the core servelts book..i am just trying to implement it.

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ShowMessage extends HttpServlet
{
private String message;
private String defaultMessage = "no message";
private int repeats = 1;

public void init(ServletConfig config) throws ServletException
{

super.init(config);
message = config.getInitParameter("message");

if(message==null)
{
message = defaultMessage;
}
try
{
String repeatString = config.getInitParameter("repeats");
repeats = Integer.parseInt(repeatString);
}
catch(NumberFormatException nfe)
{}

}//--init
public void doGet(ServletRequest request,ServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "The ShowMessage Servlet";
out.println(ServletUtilities.headWithTitle(title)+
"<body bgcolor = "#FDF5E6">\n"+
"<H1 align=center>"+ title +"</H1>");

for(int i=0;i<repeats;i++)
{
out.println(message + "<br>");
}//---for
out.println("</body></html>");

}//---doGet


}//--end of class
thanks
Trupti
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet problem