change the doPost to doGet
like
it is also advisable to have like
java.io.PrintWriter out =
new java.io.PrintWriter(resp.getOutputStream());
import java.io.*;
import javax.servlet.*;
//import javax.servlet.*;
import javax.servlet.http.*;
public class Servlet08 extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException , ServletException
{
PrintWriter out;
String title = "Simple Servlet Output";
/* set content type and other response header fields first */
response.setContentType("text/html");
/* write the data of the response */
out = response.getWriter() ;
out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY>");
out.println("<H1>" + title + "</H1>");
out.println("<P>This is output from servlet08 Servlet.");
out.println("</BODY></HTML>");
out.close();
}
}
cheers
Athy
[EMAIL PROTECTED]
sidaty wrote:
> Hi all ,
> I have a JDK1.1.7B for linux-2.2-5
> Servlet Server is JSDK2.1
>
> I wrote several servlet that attempt to use doPost method bu each time i get
> HTTP 405 RESOUCE NOT AUTHORIZED
> Internet Explorer
>
> Please What dose it mean and How can ovoid this problem.
>
> look At the following Simple example :
>
> import java.io.*;
> import java.servlet.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class servlet08 extends HttpServlet {
>
> public void doPost(HttpServletRequest request,HttpServletResponse
> response)
> throws IOException , ServletException
> {
> PrintWriter out;
> String title = "Simple Servlet Output";
>
> /* set content type and other response header fields first */
>
> response.setContentType("text/html");
>
> /* write the data of the response */
>
> out = response.getWriter() ;
> out.println("<HTML><HEAD><TITLE>");
> out.println(title);
> out.println("</TITLE></HEAD><BODY>");
> out.println("<H1>" + title + "</H1>");
> out.println("<P>This is output from servlet08 Servlet.");
> out.println("</BODY></HTML>");
> out.close();
> }
> }
>
> Each time i access it through the IE5 i get the following page
> http://localhost:8081/servlet/servlet08
>
> Impossible d'afficher la page
> La page que vous recherchez ne peut pas �tre affich�e car l'adresse est
> incorrecte.
>
> ----------------------------------------------------------------------------
> ----
>
> Essayez de la mani�re suivante :
>
> Si vous avez tap� l'adresse de cette page dans la barre d'adresses, v�rifiez
> qu'elle est correcte.
>
> Ouvrez la page de d�marrage localhost:8081 et recherchez des liens vers les
> informations voulues.
> Cliquez sur Rechercher pour trouver des informations sur Internet.
>
> HTTP 405 - Ressource non autoris�e
> Internet Explorer
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html