• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with Bean problem in JSP

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic