Results 1 to 2 of 2
  1. #1
    ravi503 is offline Member
    Join Date
    Mar 2008
    Posts
    3
    Rep Power
    0

    Post class or interface expected -compile err

    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;

    public class agencyServlet extends HttpServlet{
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException{
    response.setContentType("text/html");
    PrintWriter pw = response.getWriter();
    String connectionURL = "jdbc:mysql://192.168.0.2/balaji"?user=root&password=admin";
    Connection connection;
    try{
    String ag_name = request.getParameter("Agency Name");
    String ag_add1 = request.getParameter("Agency Address1");
    String ag_add2 = request.getParameter("Agency Address2");
    String ag_city = request.getParameter("Agency city");
    String ag_tel = request.getParameter("telephone");
    String regd_no = request.getParameter("regd.no");
    pw.println(ag_name);
    pw.println(ag_add1);
    pw.println(ag_add2);
    pw.println(ag_city);
    pw.println(ag_tel);
    pw.println(regd_no);
    Class.forName("com.mysql.jdbc.Driver");
    connection = DriverManager.getConnection(connectionURL, "root", "admin");
    PreparedStatement pst = connection.prepareStatement("insert into agency values(?,?,?,?,?,?)");
    pst.setString(1,ag_name);
    pst.setString(2,ag_add1);
    pst.setString(3,ag_add2);
    pst.setString(4,ag_city);
    pst.setString(5,ag_tel);
    pst.setString(6,regd_no);

    boolean updaterow=false;
    String regd_no=agency.setstring(6);
    string newvalue=request.getpatameter("regd.no");
    }
    if((newvalue!=null)&&(!newvalue equals("regd.no))
    {
    agency.updatestring(6,request.getparameter("regd.n o"));
    update row=true;
    }
    int i = pst.executeUpdate();
    if(i!=0){
    pw.println("<br>Record has been inserted");
    }
    else{
    pw.println("failed to insert the data");
    }


    catch (Exception e){
    pw.println(e);
    }
    }
    }
    this is my code
    i didnt recognize err
    plz help me by solving this
    and make a desc

  2. #2
    Join Date
    Mar 2008
    Posts
    13
    Rep Power
    0

Similar Threads

  1. Interface Vs Abstract Class
    By javarishi in forum New To Java
    Replies: 5
    Last Post: 06-15-2008, 05:43 AM
  2. Replies: 0
    Last Post: 04-02-2008, 07:04 AM
  3. Class inside an Interface
    By $hr!k@nt in forum New To Java
    Replies: 1
    Last Post: 12-21-2007, 10:56 AM
  4. Replies: 9
    Last Post: 08-08-2007, 07:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •