• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

problem with : HTTP Error 405

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear all,
i have a servlet running perfectly on local machine.
but i uploaded the site and try to access, its giving following error.
HTTP Error 405
405 Method Not Allowed
The method specified in the Request Line is not allowed for the resource identified by the request. Please ensure that you have the proper MIME type set up for the resource you are requesting.
Please contact the server's administrator if this problem persists.
why is this error and how can i overcome it?
any idea?
please do reply
thanks in advance
sachin
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sachin,
Can u post ur code so that i can see what is wrong???I am sure something to do with doGet or doPost method.....
Harpal
 
sachin dabhade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Harpal Singh:
Dear Sachin,
Can u post ur code so that i can see what is wrong???I am sure something to do with doGet or doPost method.....
Harpal


dear sir,
the code goes here
i have used method post on html page and doPost in servlet
===============
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import sun.net.smtp.*;

public class sanquotdhootgroup extends HttpServlet{
static Connection conn;
String Ph=null,Std,Phone,FName,LName,City,State,Email,Add1,Add2,Address;
String Zip,BuyFrom,Model,Color;
Statement stmt;
ResultSet rs;
int GodownCost=0,Registration=0,TotalCost=0,Insurance=0;

public void doPost(HttpServletRequest req,HttpServletResponse resp)throws ServletException,IOException
{

resp.setContentType("text/html");

PrintWriter out=new PrintWriter(resp.getOutputStream(),true);

out.println("<html>");

out.println("<head>");
out.println("<title>Dhoot Motors</title>");
out.println("</head>");
out.println("<body>");
out.println("<font size=3>");

FName=req.getParameter("FName");
LName=req.getParameter("LName");
City=req.getParameter("City");
State=req.getParameter("State");
Std=req.getParameter("Std");
Phone=req.getParameter("Phone");
Add1=req.getParameter("Address1");
Add2=req.getParameter("Address2");
Email=req.getParameter("email");
Zip=req.getParameter("Zip");
BuyFrom=req.getParameter("BuyFrom");
Model=req.getParameter("Model");
Color= req.getParameter("Color");
Address=Add1+" "+Add2;
Ph="("+Std+")"+Phone;

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc dbc:ditl","ditl","ditl");
stmt=conn.createStatement();
String q="insert into NewSantroQuot (FName, LName, EMail, Phone, City, Zip, State, BuyFrom, Model, Address,Color) values('"+FName+"','"+LName+"','"+Email+"','"+Ph+"','"+City+"','"+Zip+"','"+State+"','"+BuyFrom+"','"+Model+"','"+Address+"','"+Color+"')" ;
String q1="select GodownCost,Insurance,Registration from OutSantroCost where Model='"+Model+"'AND Color='"+Color+"'";
String q2="select GodownCost,Insurance,Registration from InSantroCost where Model='"+Model+"'AND Color='"+Color+"'";
stmt.executeUpdate(q);


if (BuyFrom.equals("Ex_Showroom"))
{
rs=stmt.executeQuery(q2);
while(rs.next()){
GodownCost=Integer.parseInt(rs.getString(1));
Insurance=Integer.parseInt(rs.getString(2));
Registration=Integer.parseInt(rs.getString(3));
}
}
else
{
rs=stmt.executeQuery(q1);
while(rs.next()){

GodownCost=Integer.parseInt(rs.getString(1));
Insurance=Integer.parseInt(rs.getString(2));
Registration=Integer.parseInt(rs.getString(3));
}
}

TotalCost=GodownCost+Registration+Insurance;
out.println("<font size=4 color=\"red\"><b>Dhoot Motors Ltd</b></font>");
out.println("<br>Dhoot Compound , Adalat Road");
out.println("<br>Aurangabad 431005");
out.println("<br>Phone : 338855,338855");
out.println("<hr>");

out.println("<table cellspacing=3>");
out.println("<tr><td><font color=blue><b> Thanks for the Quotation</font><font color=red> "+FName+" "+LName+"</b></font></td></tr>");
out.println("<tr></tr><tr></tr><tr><td bgcolor=#dfdfdf>Model </td><td bgcolor=#dfdfdf>Santro "+Model+"</td></tr>");
out.println("<tr><td bgcolor=#dfdfdf>Color</td><td bgcolor=#dfdfdf>"+Color+"</td></tr>");

out.println("<tr><td bgcolor=#dfdfdf>Vehicle Cost</td><td bgcolor=#dfdfdf>"+GodownCost+"</td></tr>");
out.println("<tr><td bgcolor=#dfdfdf>Insuarence Cost</td><td bgcolor=#dfdfdf>"+Insurance+"</td></tr>");
out.println("<tr><td bgcolor=#dfdfdf>Registration Cost</td><td bgcolor=#dfdfdf>"+Registration+"</td></tr>");

out.println("<tr><td bgcolor=#dfdfdf><b>Total Price </b></td><td bgcolor=#dfdfdf >"+TotalCost+"</td></tr>");
out.println("<tr></tr><tr><td bgcolor=#dfdfdf><font color=blue> Terms & Condition :</font></td></tr> ");
out.println("<tr><td bgcolor=#dfdfdf>Purchase to be made : "+BuyFrom+"</td></tr>");

out.println("<tr><td bgcolor=#dfdfdf> This Quotation is not valid without authorised signature.</td></tr> ");
out.println("<tr><td bgcolor=#dfdfdf> Quotation is valid for 30 days</td></tr> ");
out.println("<tr><td bgcolor=#dfdfdf> Quotation is valid within Aurangabad jurisdiction</td></tr> ");
out.println("<tr><td bgcolor=#dfdfdf> Delivery of the car depends on the availability</td></tr> ");
out.println("<tr><td bgcolor=#dfdfdf> We Provide 3 year extended warranty</td></tr> ");

out.println("<tr><td><font color=blue><b>Thanks for visiting this site</b></font></td></tr></table><body></html>");

}

catch(Exception sq)
{
out.println("Error : "+sq);
}

}
out.flush();
out.close();
}
}
====================
sachin

[This message has been edited by sachin dabhade (edited May 16, 2001).]
[This message has been edited by sachin dabhade (edited May 17, 2001).]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I hope i understood your problem correctly, but just wanted to check. Did you check the settings of the webserver on the The server? I mean is the servlet in a proper directory of a webserver or have u registered it(if u need to). Or u may just wanna check the path which u have put in HTML to call the servlet. I am sure u must have checked all this but just wanted to confi
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sachin dabhade:
i have used method post on html page and doPost in servlet


Well... are you really, really sure about that first bit? What you think is happening and the error message you get are contradictory, and the first thing to do IMHO is sort out which of them is wrong. Try adding a doGet with just 'out.println("Eeks! A get!");' and see what happens.
- Peter
 
sachin dabhade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please check the following link.
http://www.cord2cables.com/dm/santro.html
and click on quotation
then here,
the servlet " sanquotdhootgroup " is called using post method
and the servlet code is given above
sachin
[This message has been edited by sachin dabhade (edited May 17, 2001).]
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
try method=post instead of method="post"
in your NewSantroQuot.html
Hope it helps,
Thomas
 
Thomas Baumann
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way:
Is your URL in the Form-Tag (NewSantroQuot.html) ok?
Thomas
 
Harpal Singh
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Sachin,
Nothin to worry abt!It is a simple problem,Let us make a few changes....
1)in your servlet replace doPost() with service() method without changing anything else and now lets see if ur problem is solved
OR
2)if this does not work out make the above said change and change the method=post in html page to method=get
I am sure it should work .......Please let me know ASAP else I will set up the database and work on it...
Thanks,
Harpal
 
Does this tiny ad smell okay to you?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic