[opencms-dev] nullpointer exception while using contentload on empty folder
Nigel Kersten
nigel at cofa.unsw.edu.au
Thu Feb 23 22:36:51 CET 2006
I've just realised your solution was only to the "how to stop the
null pointer exception", and not "how to produce a new button for an
empty folder" :)
my fault for thread hijacking somewhat...
Anyway, I think you're doing this a long way round, I've been doing
it like this in a page that collects all content in a folder location
"categoryLocation" as it seems simpler to just go "give me a list of
all resources matching this type in the folder. if it's not empty, do
the content load.:
It doesn't seem necessary to go and construct a collector for the
folder, easier to simply list the resources I think?
CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request, response);
String categoryLocation = "/wherever/you/are/trying/to/load/from";
int cofaSupportType = 33;
java.util.List supportItems = cmsObject.readResources
(categoryLocation, CmsResourceFilter.requireType(cofaSupportType));
if ( supportItems.isEmpty()) {
// still trying to work out how to produce something useful here.
} else {
%>
// do the standard cms contentload as this folder does
contain the requested type of structured content.
<%
}
--
Nigel Kersten [Senior Technical Officer]
College of Fine Arts, University of NSW, Australia.
CRICOS Provider Code: 00098G
More information about the opencms-dev
mailing list