Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Null data member crashing TagUtils Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Null data member crashing TagUtils" Watch "Null data member crashing TagUtils" New topic

Null data member crashing TagUtils

John LeBaptiste

Joined: May 04, 2006
Posts: 4
I have a number of classes as follows:


Report has ----> private Vector<IOS> principals = new Vector<IOS>(); as a member variable
IOS has -------> private Scientist scientist; as a member variable
Scientist ------> private ActionErrors warningMessages = new ActionErrors();

My app is reading in some data from a file and loading it into a database. I am using Struts. The scientist datamember is NULL. When my object passes through TagUtils, I am getting the following error when principals[0].scientist.warningMessages runs through TagUtils:

SEVERE: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Invalid argument looking up property principals[0].scientist.warningMessages of bean report
at org.apache.struts.taglib.TagUtils.lookup(
at org.apache.struts.taglib.bean.DefineTag.doEndTag(

Is there any way to define scientist or instantiate so that the error does not occur? I don't want to modify the Struts code one bit.
I agree. Here's the link:
subject: Null data member crashing TagUtils
It's not a secret anymore!