Skip to content

Instantly share code, notes, and snippets.

@TheCrazyT
Created April 2, 2023 08:04
Show Gist options
  • Save TheCrazyT/40b615aff09cda175af0c56d68201f25 to your computer and use it in GitHub Desktop.
Save TheCrazyT/40b615aff09cda175af0c56d68201f25 to your computer and use it in GitHub Desktop.
package org.slf4j;
public class Logger {
public static String test() {
System.out.println("inside Logger.test");
return "Logger.test result";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.20.1.final using JasperReports Library version 6.20.1-7584acb244139816654f64e2fd57a00d3e31921e -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f037d449-73e2-4a90-ad28-8e72b0c29383">
<scriptlet name="SL_TEST" class="test.Test"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<textField>
<reportElement x="270" y="51" width="100" height="30" uuid="4b502d1c-afef-4c24-8b4a-3a703ebe4aef"/>
<textFieldExpression><![CDATA[$P{SL_TEST_SCRIPTLET}.test()]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
package test;
import org.slf4j.Logger;
public class Test extends net.sf.jasperreports.engine.JRDefaultScriptlet{
public static String test() {
System.out.println("this ClassLoader");
System.out.println(Test.class.getClassLoader());
System.out.println("---------------");
System.out.println("Class");
System.out.println(Logger.class);
System.out.println("ClassLoader");
System.out.println(Logger.class.getClassLoader());
System.out.println(Logger.test());
return "Test.test result";
}
public static void main(String[] args) {
System.out.print(test());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment