Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with Bean problem in JSP  RSS feed

 
Abel Sanchez
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have the next bean code:
package BBSpack;
import java.util.*;
import java.sql.*;
public class BBS {
public String categoria = "";
public int prueba = 0;

public BBS() {
initComponents();
}

private void initComponents() {
//String categoria = "";
//int prueba = 0;
try {
String userName = "root";
String password = "";
String url = "jdbc:mysql:3306/localhost/bbs";
Class.forName("org.gjt.mm.mysql.Driver").newInstance ();
//Connection conn = DriverManager.getConnection (url, userName, password);
prueba = 1;
} catch (Exception e) {
prueba = -1;
}
}
}
this don't work in JSP, always is -1, when i execute the bean in a JSP, what ca i do for solve this?, thanks a lot!!!
 
Dominic Paquette
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Maybe you should print the error message in you catch clause to get a hint on what the problem might be.
Dominic
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!