Jump to content

Report with scriptlet not working on JasperServer


rickn

Recommended Posts

I created a report that uses the scriptlet listed below.  The report runs in iReport but not when I deploy it to the JasperServer on the same machine.   The report scriptlet property is set to "com.gbi.MyScriptlet" and the JAR file was added as a resource to the report.   I tried using the JAR resource from the repository and as an uploaded local file but the results were the same.   When I open a report with input controls, i just get a blank page.   If there are no input controls, the "Please wait   Loading..." box comes up but never goes away.

I'm new to Jaspersoft and Java so any help will be greatly appreciated.

 

Code:
package com.gbi;import net.sf.jasperreports.engine.JRDefaultScriptlet;import net.sf.jasperreports.engine.JRScriptletException;import java.util.*;public class MyScriptlet extends JRDefaultScriptlet{     long pageInitTime;       @Override    public void beforePageInit() throws JRScriptletException {        pageInitTime = new java.util.Date().getTime();           }       public long getLastPageTime() {        long now = new java.util.Date().getTime();        return new Long(now - pageInitTime);    }      public String ArrayToString(Collection coll) {  // create comma-delimited string from collection           StringBuilder str = new StringBuilder("");           Iterator it = coll.iterator();    while (it.hasNext())    {            str.append(it.next());        str.append(",");    }           return (str.substring(0,str.length()-1));    }}
Link to comment
Share on other sites

  • 1 year later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...