1 28 package scriptlets; 29 30 import net.sf.jasperreports.engine.JRDefaultScriptlet; 31 import net.sf.jasperreports.engine.JRScriptletException; 32 33 34 38 public class WebappScriptlet extends JRDefaultScriptlet 39 { 40 41 42 45 public void afterGroupInit(String groupName) throws JRScriptletException 46 { 47 String allCities = (String )this.getVariableValue("AllCities"); 48 String city = (String )this.getFieldValue("City"); 49 StringBuffer sbuffer = new StringBuffer (); 50 51 if (allCities != null) 52 { 53 sbuffer.append(allCities); 54 sbuffer.append(", "); 55 } 56 57 sbuffer.append(city); 58 this.setVariableValue("AllCities", sbuffer.toString()); 59 } 60 61 62 65 public String hello() throws JRScriptletException 66 { 67 return "Hello! I'm the report's scriptlet object."; 68 } 69 70 71 } 72 | Popular Tags |