473,320 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HTTP 405 error

44
hey friends i'm getting an error
Expand|Select|Wrap|Line Numbers
  1. HTTP Status 405 - HTTP method GET is not supported by this URL
in this code

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import java.sql.*;
  5.  
  6. public class E_3_DeptEntry extends HttpServlet
  7. {
  8.     public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException
  9.     {    String a,b,c,d,e,f;
  10.         int i;
  11.         Connection con;
  12.         try
  13.         {
  14.         res.setContentType("text/html");
  15.  
  16.         Class.forName("oracle.jdbc.driver.OracleDriver");
  17.         con=DriverManager.getConnection("jdbc:Oracle:thin:@server:1521:Oracle8i","ty289","ty289");
  18.         String Query="insert into dept Values(?,?,?)";
  19.         Statement st=con.createStatement();
  20.         PreparedStatement ps;
  21.         ps=con.prepareStatement(Query);
  22.         a=(String)req.getParameter("txtNo");
  23.         b=(String)req.getParameter("txtName");
  24.         c=(String)req.getParameter("txtLoc");
  25.         ps.setString(1,a);
  26.         ps.setString(2,b);
  27.         ps.setString(3,c);
  28.         ps.executeUpdate();
  29.  
  30.         PrintWriter out=res.getWriter();
  31.         ResultSet rs=st.executeQuery("select * from dept");
  32.         ResultSetMetaData md=rs.getMetaData();
  33.         int num=md.getColumnCount();
  34.         out.println("<html><body><table border=1><tr>");
  35.         for(i=1;i<=num;i++)
  36.         {
  37.         out.print("<th>"+md.getColumnName(i)+"</th>");
  38.         }
  39.         out.println("</tr>");
  40.         while(rs.next())
  41.         {    d=rs.getString(1);
  42.             e=rs.getString(2);
  43.             f=rs.getString(3);
  44.             out.println("<tr><td>");
  45.             out.println(d);
  46.             out.println("</td><td>");
  47.             out.println(e);
  48.             out.println("</td><td>");
  49.             out.println(f);
  50.             out.println("</td></tr>");
  51.  
  52.         }
  53.         out.println("</table>"); 
  54.         con.commit();
  55.         out.println("<a href=DeptForm_297.class>BACK</a>");     
  56.  
  57.         out.println("</body></html>");     
  58.  
  59.         }
  60.         catch (Exception ae){
  61.         System.out.println(ae.getMessage());
  62.         }
  63.  
  64.     }
  65. }
please help me out
Oct 16 '07 #1
2 1346
You dont have a doGet method in your code.. If you see any basic tutorial for Servlet, you will find that doGet & doPost should be implemented compulsarily.
Oct 16 '07 #2
bravo
43
check the html code, the form tag should have method= doPost
Oct 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
10
by: | last post by:
I am accessing the same error-containing ASP page on an ISP server using w2k IE6 but with different effect. On the first computer I get several line of HTML outputed by ASP, shown correctly by...
7
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
8
by: Rene | last post by:
Hi, I'm spend many hour to fix this problem, read many articles about it but no article gave a solution. To isolate the problem I've created in IIS6 (WServer2003) a virtual directory test to...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
8
by: Andreas Klemt | last post by:
Hello, I get this error Message "cannot redirect after http headers have been sent" when I do this response.redirect ("home.aspx") How can I find out with vb.net if already a http header has...
11
by: Tomas Kepic | last post by:
Hi, i'm trying to create my first ASP.NET project ( HelloASPWorld project) but an error occured when I put OK button in NewProject. ERROR: "The Web server reported the following error when...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
0
by: Lee88 | last post by:
In VB6, I am using the Web Browser Control's NavigateError Event to trap HTTP errors. It returns StatusCode, like "500", which is this: HTTP_STATUS_SERVER_ERROR 500 The server encountered...
16
by: Harry Simpson | last post by:
I've been away from ASPNET - I open up a new Web app in VS2008 and go into properties and select to use IIS instead of the personal web server. Then I run in debug mode and it says I have to set...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.