M
mcraven.2
I'm having trouble debugging some code that I created in JSP. Advice
on the problem itself or how I can go about debugging it would be
appreciated. The way that I debug my code now is I change the JSP
webpage and then look at it through a browser to see if there is an
error in the code.
The error that I'm getting is I'm trying to create an SQL statement
with the multiple table columns and values in the statement. So a
pseudo statement would be INSERT INTO table (col1,col2,col3) VALUES
(val1,val2,val3). The names of the columns (col1,col2...) come from a
tokenized string which I tokenize into an array of strings. So I have
a statment like this:
tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
MM_columns = new String[tokens.countTokens()];
for (int i=0; tokens.hasMoreTokens(); i++) MM_columns =
tokens.nextToken();
Where I run into an error is that I try to create a columns_string that
in the end will have the value of "col1,col2,col3". To create this
string I first need to assign "col1" to columns_string. I've tried
statements like
columns_string = MM_columns[0];
columns_string.append(MM_columns[0]);
columns_string.append(MM_columns);
columns_string = MM_columns[1];
but I keep on getting a null pointer exception. I have declared
columns_string correctly because I can put in a simple dummy string and
the code works. The MM_columns[0] work on another set of my forms it
is getting initialized correctly at least in my other forms.
Does anyone have any ideas on how I can trouble shoot this? Anything
stick out as missing in my code?
Brian
on the problem itself or how I can go about debugging it would be
appreciated. The way that I debug my code now is I change the JSP
webpage and then look at it through a browser to see if there is an
error in the code.
The error that I'm getting is I'm trying to create an SQL statement
with the multiple table columns and values in the statement. So a
pseudo statement would be INSERT INTO table (col1,col2,col3) VALUES
(val1,val2,val3). The names of the columns (col1,col2...) come from a
tokenized string which I tokenize into an array of strings. So I have
a statment like this:
tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
MM_columns = new String[tokens.countTokens()];
for (int i=0; tokens.hasMoreTokens(); i++) MM_columns =
tokens.nextToken();
Where I run into an error is that I try to create a columns_string that
in the end will have the value of "col1,col2,col3". To create this
string I first need to assign "col1" to columns_string. I've tried
statements like
columns_string = MM_columns[0];
columns_string.append(MM_columns[0]);
columns_string.append(MM_columns);
columns_string = MM_columns[1];
but I keep on getting a null pointer exception. I have declared
columns_string correctly because I can put in a simple dummy string and
the code works. The MM_columns[0] work on another set of my forms it
is getting initialized correctly at least in my other forms.
Does anyone have any ideas on how I can trouble shoot this? Anything
stick out as missing in my code?
Brian