File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes getting rid of nulls jsp/beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting rid of nulls jsp/beans" Watch "getting rid of nulls jsp/beans" New topic

getting rid of nulls jsp/beans

rich werth
Ranch Hand

Joined: Sep 21, 2001
Posts: 57
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
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
String ename = (cart.getRemovenull(eresults.getString("FIRSTNAME"));

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
Sorry it actually is that. and I still get the error. I typed in the code and didn't cut n paste.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
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
or in a jar file in
If not, Tomcat tries to find the class in the "current directory" which is certainly not where you put the class file.
author of:
rich werth
Ranch Hand

Joined: Sep 21, 2001
Posts: 57
the problem was with WebSphere. Well it was with me not restarting webSphere every time I changed the bean. But it works now.
I agree. Here's the link:
subject: getting rid of nulls jsp/beans
It's not a secret anymore!