mike sutton

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

Recent posts by mike sutton

o.k. third try, this time without the code tag:
try {
stmt = l.dbCon.createStatement();
rs = stmt.executeQuery(qry.toString());
ResultSetMetaData rsmd= rs.getMetaData();
int numberofcolumns = rsmd.getColumnCount();
for (int i =1; i<= numberofcolumns; i++ ){

String columnlabel = rsmd.getColumnLabel(i);
String columnname = rsmd.getColumnName(i);

out.println("<td >" + columnlabel + "");
out.println("<td >");
out.println("<input type='text' name='"+ columnname +"' size='25'>");
I am not sure what happened when I tried to post my code, but here it is again
I am using getMetaData to retrieve column names from a database to build a form in one of my servlets.
I thought that

would return the caption instead of the name, but it is not, or I am doing something wrong.
How can I get the column caption in an access database instead of the column name?
Here is the code from the servlet:
nevermind I figured it out.
I forgot a line of code.
I added this line

after the line

and it works fine now
23 years ago
I have copied the sendmail code from "Professional Java Server Programming". I keep recieving the 'There was an error sending the message' error that is called in the code. I think it is because the smtp host is wrong. here is the code.

I have altered the code to try to hard code the smtp server. But other than that it is directly from the book. Does anyone have a clue as to why this is not working?
thanks in advance.
23 years ago
I just finished a project using servlets, It was an add to an existing site. The first question from the client was how hard would it be to make this a seperate site and change it's look. Had I known this ahead of time I would have made it using jsp. Oh well lesson learned.
23 years ago
I have been working on ways to encrypt mail with pgp. I have I have a program using asp, but was hoping that java servlets could be used. is anyone doing this, and if so would they like to share some examples or helpful ideas.
23 years ago
What I need to do is change a field in a record.
for example:
If a user is searching the database and notices a name is misspelled (John Doe should be John Dough etc.) or an address needs to be changed.

btw -- still getting same result after the suggested change.

[This message has been edited by mike sutton (edited December 28, 2000).]
Here is another simple problem that I cannot figure out.
I am trying to edit records in a database. (for example user notices a mistake and wants to correct it.) here is my code

try {

stmt = l.dbCon.createStatement();
stmt.executeUpdate("UPDATE students SET name LIKE \"" + udstudent + "\" WHERE student_id = \"" + udid );

catch (SQLException e) {
res.sendError(res.SC_ACCEPTED, "The request has been accepted, but it failed to complete due to an error updating the database.");
return ;
I keep getting the sql exception. I am sure the problem is in the sql statement, but every variation I try produces the same result.
thanks in advance
thanks guys. it worked
basic things like this that experienced programmers take for granted can cause countless headaches for newbies like me.
keep up the good work.
23 years ago
is there any way to assign the value of a text box from an html form to an int variable?
the user will input a number in the text box of a form, it will then be passed to a servlet, the servlet will then compare that number to an auto number field in an access database.

or does anyone know how to pass a numeric value in an html form?

[This message has been edited by mike sutton (edited December 21, 2000).]
23 years ago
I want to do different things based on the results of a field in my table. I can do a

and it will show me the correct information. But when I try this line
if (rs.getString("admin_type").equals("ORGIN")) {...
I get an sql exception.
could someone please tell me what is wrong with this line, or if I am totally off base how I can implement an if statement based on the result of a field in a dbase.

thanks in advance
never mind I figured it out. I added a vector like this

Vector type = new Vector();
added a string
String[] admintype = null;
and then added this code
admintype = new String[type.size()];
now this line works
if (admintype.equals("ORGIN")) {...
(thought I would add this in case any other newbie had a similar problem.)

[This message has been edited by mike sutton (edited December 14, 2000).]
[This message has been edited by mike sutton (edited December 14, 2000).]
sorry, I wasn't paying the attention. I recieved a "page cannot be displayed" error.
so I think it is in the page I am trying to call. Not in the code I showed above.
23 years ago
I need help loading one servlet from another servlet.
here is the code I have trying to do this. it compiles just fine but when try to submit the form I get a page not found error

please keep answer simple. I am very new to java.

out.println("<form name='submit' action='' method='post' onsubmit='return validate()'>");

out.println("<font color='#000059' ><center>");
out.println("<font size='2' face='Arial'><center><b>Student:</b></font><br>");
out.println("<input type='text' size='25' name='student'></center><br>");
out.println("<font size='2' face='Arial'><center><b>Year in school:</b></font><br>");
out.println("<input type='text' size='25' name='year'></center><br>");
out.println("<font size='2' face='Arial'><center><b>Intended school:</b></font><br>");
out.println("<input type='text' size='25' name='school'></center><br>");
out.println("<br><center><input type='submit' name='B1' value='Submit')'>  ");
out.println("<input type='reset' name='B2' value='Reset'></center></p></td></tr>");
23 years ago