Dear Dspace Community,
I am trying to write a java code that returns (or displays) all the items
of a collection (perhaps using a collection id).
In the past I was able to get the bitstreams, the item name and the
collection name and Id.
But in this code I am not sure what I am doing wrong!!! Any help will be
appreciated and if you know other ways to go about this problem please let
me know.
Using *Dspace 4.3 JSPUI*.
I have tried the following code but its giving me an error at line 631:
*Exception:*
*org.apache.jasper.JasperException: An exception occurred processing JSP
page /display-statistics.jsp at line 631628: boolean reached =
false;629:630: try {631: ItemIterator itr =
collection.getAllItems();632: while (itr.hasNext() && reached ==
false){633: Item collection_items = (Item)
request.getAttribute("collection_items"); 634: collection_items
= itr.next();*
In this example I want to display only the first 10, just to be safe.
*Collection collection = (Collection) dso;*
* int counter = 0;*
* boolean reached = false;*
* try {*
* ItemIterator itr = collection.getAllItems();*
* while (itr.hasNext() && reached == false){*
* Item collection_items = (Item) request.getAttribute("collection_items"); *
* collection_items = itr.next(); *
* System.out.println(collection_items.getName()); // display item names*
* counter ++;*
*if (counter == 10){*
*reached = true;*
*}*
* }//end of while*
* }catch (SQLException e){*
* System.out.println(e);*
* }*
On some other pages (non items for ex) I get a cast error:
*Exception:java.lang.ClassCastException: org.dspace.content.Item cannot be
cast to org.dspace.content.Collection*
--
You received this message because you are subscribed to the Google Groups
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.