Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-06-2008, 12:57 PM
Member
 
Join Date: Mar 2008
Posts: 3
ravi503 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-26-2008, 12:45 PM
Member
 
Join Date: Mar 2008
Posts: 13
geeta_ravikanti is on a distinguished road
what is the error u r getting
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interface Vs Abstract Class javarishi New To Java 5 06-15-2008 06:43 AM
what is the Priority for execution of Interface class and a Abstract class Santoshbk Advanced Java 0 04-02-2008 08:04 AM
Generating Interface from a Class JavaForums Java Blogs 0 01-04-2008 12:20 PM
Class inside an Interface $hr!k@nt New To Java 1 12-21-2007 11:56 AM
illegal start of expression & class, interface, or enum expected silverq_82 New To Java 9 08-08-2007 08:16 PM


All times are GMT +3. The time now is 05:06 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org