This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi i'm trying to get rid of nulls passed in from a dataBase. I try a few variations of this but i always get an error. I usually get method getRemovenull not found in class. Can anyone help me out with this i'm new and not even really sure if I'm going about this the right way......thanks My jsp looks something like this.... <%@ page import="java.sql.*, java.util.* " %> <%@ page import="remove_nulls" %> <jsp:useBean id="cart" class="remove_nulls" /> String ename = (cart.getRemovenull(eresults.getString("FIRSTNAME")); <td width="7%"><%= ename %></td> my bean looks something like this public class remove_nulls{ private String data_in; public String getRemove_null(String data_passed_in) { data_in = data_passed_in; if (data_in == null) { return ""; // remove null } else { return data_in; // return data } } // end method to resolve nulls }
Shouldn't it be getRemove_null, not getRemovenull? ------------------ Miftah Khan - Sun Certified Programmer for the Java 2 Platform - Sun Certified Web Component Developer for the J2EE Platform
rich werth
Ranch Hand
Joined: Sep 21, 2001
Posts: 57
posted
0
Sorry it actually is that. and I still get the error. I typed in the code and didn't cut n paste.
This has got to be one of the most common bean problems. You can NOT use just the class name in these tags: <%@ page import="remove_nulls" %> <jsp:useBean id="cart" class="remove_nulls" /> Your class MUST be in a package and the package MUST be named in the tags: <%@ page import="mypackage" %> <jsp:useBean id="cart" class="mypackage.remove_nulls" /> Your class will then have to be in ...WEB-INF\classes\mypackage\ or in a jar file in ...WEB-INF\lib\ If not, Tomcat tries to find the class in the "current directory" which is certainly not where you put the class file. Bill ------------------ author of: