dave green

Greenhorn
+ Follow
since Oct 15, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dave green

With the increasing number of Android phones and tablets what do you think the chances of developers becoming frustrated with the increasing number of systems to test and develop on and users frustration of finding that certain apps dont work on their current model? With Apple only having a couple of handsets in service at one time they have made it easier to control this, but do people think this limits developers and users choice?
13 years ago
line 63 is the last line of this code section which shows everything upto that point. it is basically where it tries to create the statement. I keep thinking it is something to do with the mySql driver because I am trying to run it on the machine it will work from normally, however it works fine on my developer machince when launched from NetBeans

public class initialEnq extends HttpServlet {

Connection con;

public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pd206",
"root", "password");
} catch (ClassNotFoundException e) {
System.out.println("Class still not found");
} catch (SQLException e) {
System.out.println("SQL Exception in init");
}
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String a = request.getParameter("number");
String b = request.getParameter("rank");
String c = request.getParameter("surname");
String d = request.getParameter("forenames");
String e = request.getParameter("trade");
String f = request.getParameter("unit");
String g = request.getParameter("unitAddress");
String h = request.getParameter("workContactNo");
String i = request.getParameter("mobileContactNo");
String j = request.getParameter("actionTaken");
String k = request.getParameter("actionRequired");
String l = request.getParameter("submitedBy");
String m = request.getParameter("dateCompleted");

submitData(a, b, c, d, e, f, g, h, i, j, k, l, m);

RequestDispatcher view = request.getRequestDispatcher("submited.jsp");
view.forward(request, response);
}

public void submitData(String a, String b, String c, String d, String e, String f,
String g, String h, String i, String j, String k, String l, String m) {

try {
Statement stmt = con.createStatement();
it doesnt come up with a line on the code. Its when I press the submit button on the web page of the app it goes to the error message. The first line on the stack trace is:

Servlet.service() for servlet initialEnq threw exception java.lang.NullPointerException at initalEnq.submitData(initialEnq.java:63)
I'm currently building a database app where the web app sits on Applications Server 9.1 and after a user fills in a form it the information is sent to a MySql database.

When I press submit I get a java.lang.NullPointerException. I have placed the driver in the jre/lib/ext folder and the code for connecting to the database is as follows:

try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pd206",
"root", "password");
} catch (ClassNotFoundException e) {
System.out.println("Class still not found");
} catch (SQLException e) {
System.out.println("SQL Exception in init");
}

The system is currently working on a local machine and is not expected to go onto a full network until later in the year.

Can somebody please help?
I am creating a program where a JOptionDialog comes up part the way through a task and gets the user to change what they are doing. The problem I get is that the person would be typing and the button keeps being pressed immediately when they press the space bar.

Is there away to disable the spacebar or return key from pressing the button or a way to shift focus away from the "ok" button which is selected by default.

Thanks for any help,
16 years ago
nothing changes, the char is just being printed as a char next to the string. So on the screen it will look like it is part of the string when in fact you still have 1 String and 1 char.
16 years ago
This is probably a simple one and I am being stupid, however,

I am making a simple server program to receive results from a test on a clients computer, I have checked through everything and it appears to be fine. I am trying to test both programs on the same computer just to check it works, is this possible and how should I do it. At the moment I am just opening both and nothing happens although both function normally on their own they dont interact.

Thanks for any help,
Thanks alot for that, I was obviously trying to overcomplicate it. Have found a much easier way
16 years ago
I'm trying to use a messageDialog box as a trigger for a timer. The program is to test touch typing so when the box comes up at the end of the test period there is a good chance that they can be pressing either the spacebar or the enter key which closes the dialog. Is their anyway to prevent these keys doing that. Or a way to remove focus from the OK button when it pops up.

Thanks,
16 years ago
Please help,

I am trying to create a reports program for a test program I created. The results are saved in a .txt file with a "/" seperator and each new test is saved to a new line in the file. I then want to be able to view the results in a JTable. I can get it to work for only the first result. How do I get it to create a new row for each line of the text document?

I am using String [][] data = new String [][]{{results[0], results[1]}} when reading from the file. I am probably going about this the wrong way, I know I would need to use an int variable for results[0] etc which i could do i am just not sure how to make it create a new row so that i would need to do it.

Any help appreciated
16 years ago