小编Ale*_*x K的帖子

在JasperReports中无法正确呈现PAGE_COUNT ...?

我已将页脚的页面x添加到我的报告中,但PAGE_COUNT似乎不起作用.

也许问题出现是因为我有很多子报告?

我明白了:

Page 1 of 1

Page 2 of 0

Page 3 of 0

Page 4 of 0
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

jasper-reports

8
推荐指数
3
解决办法
3万
查看次数

在cygwin中运行gcc

我在我的系统上安装了Cygwin.但是,当我尝试使用gcc命令时,它说:

bash: gcc: command not found

有人能为我提供解决方案吗?

gcc cygwin

8
推荐指数
2
解决办法
3万
查看次数

将Jasper集成到Rails 3中

我试图在这个wiki之后将rails 3应用程序与jasper集成:

http://wiki.rubyonrails.org/rails/pages/HowtoIntegrateJasperReports

但似乎很多信息都没有更新,所以很难让它自己工作.我还在ruby-forum上阅读了一个主题:http://www.ruby-forum.com/topic/139453 并解释了一些细节,但仍无法使其正常工作.

我的第一个问题与render_to_string方法有关:当控制器方法运行时,我收到"模板丢失"错误:

这是方法:

def report
  @customers = Customer.all
  send_doc(render_to_string(:template => report_customers_path, :layout => false), '/pdfs', 'report.jasper', "customers", 'pdf')
end
Run Code Online (Sandbox Code Playgroud)

虽然这看起来很简单但我不明白为什么会这样.不render_to_string布局=>假 suposed让我行动的字符串结果?我也试过:动作而不是:模板,但它也是一样的.

如果任何对此集成有一定专业知识的人可以提供帮助...先谢谢,André

ruby ruby-on-rails jasper-reports ruby-on-rails-3

8
推荐指数
1
解决办法
1973
查看次数

一个很好的小例子来演示java中的wait()和notify()方法

任何人都可以在java中为我提供一个很好的小例子演示wait()和notify()功能.我试过下面的代码,但它没有显示我的预期.

public class WaitDemo {
    int i = 10;

    int display() {
        System.out.println("Lexmark");
        i++;
        return i;
    }
}
Run Code Online (Sandbox Code Playgroud)
public class ClassDemo1 extends Thread {

    private WaitDemo wd = new WaitDemo();

    public static void main(String[] args) {
        ClassDemo1 cd1 = new ClassDemo1();
        ClassDemo1 cd2 = new ClassDemo1();
        cd1.setName("Europe");
        cd2.setName("America");
        cd1.start();
        cd2.start();

    }

    synchronized void display() {
        System.out.println("Hello");
        notifyAll();
    }

    public void run() {

        synchronized (this) {
            try {
                {
                    notify();
                    System.out.println("The thread is " + currentThread().getName());
                    wait();
                    System.out.println("The value is " …
Run Code Online (Sandbox Code Playgroud)

java multithreading notify wait

8
推荐指数
1
解决办法
3万
查看次数

使用比较器排序字符串长度

在尝试根据元素字符串长度对数组进行排序时,我遇到了编译错误.我有一套开始,

Set<String> arraycat = new HashSet<String>();
//add contents to arraycat
String[] array = arraycat.toArray(new String[0]);
//array looks like this now:
//array=[cat,cataaaa,cataa,cata,cataaa]
Run Code Online (Sandbox Code Playgroud)

我理想的是要排序到

array=[cat,cata,cataa,cataaa,cataaaa]
Run Code Online (Sandbox Code Playgroud)

所以我有一个类型的比较器

class comp implements Comparator {

    public int compare(String o1, String o2) {
        if (o1.length() > o2.length()) {
            return 1;
        } else if (o1.length() < o2.length()) {
            return -1;
        } else {
            return 0;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

然后我打电话给上课

Collections.sort(array, new comp());
Run Code Online (Sandbox Code Playgroud)

但是,它抛出了两个编译错误:

comp is not abstract and does not override abstract method   compare(java.lang.Object,java.lang.Object) in java.util.Comparator
class comp …
Run Code Online (Sandbox Code Playgroud)

java

8
推荐指数
4
解决办法
3万
查看次数

JasperReports:通过Param值更改字体大小

<style name="blueStyle" >
    <conditionalStyle>
        <conditionExpression><![CDATA[($P{INDIRIZZO}).length()>30 ?  Boolean.TRUE : Boolean.FALSE]]></conditionExpression>
        <style  style="blueStyle"  fontSize="3"/>
    </conditionalStyle>
</style>
<parameter name="INDIRIZZO" class="java.lang.String"/>

[...]

<textField>
    <reportElement x="178" y="94" width="157" height="17"/>
    <textElement>
        <font fontName="Arial" size="9"/>
    </textElement>
    <textFieldExpression class="java.lang.String"><![CDATA[$P{INDIRIZZO}]]></textFieldExpression>
</textField>
Run Code Online (Sandbox Code Playgroud)

INDIRIZZO长度> 30 时,我想缩小字体大小 ...

但这不起作用....

jasper-reports

8
推荐指数
2
解决办法
2万
查看次数

如何在一个textField中显示多个字段值

可以帮助在一个字段中添加多个DB字段值.

假设我有3个DB字段:

Name
Address
Age
Run Code Online (Sandbox Code Playgroud)

我想在同一个字段中显示所有3个字段:

John Peter 28.
Run Code Online (Sandbox Code Playgroud)

我尝试了彼此相邻的3个字段,它确实有效,但是当我包装文本时.看起来很糟糕:

名称

Jo.pe.28
hn te
   r
Run Code Online (Sandbox Code Playgroud)

我的要求是在一个文本字段中显示数据,例如:John.Peter.26

jasper-reports

8
推荐指数
2
解决办法
2万
查看次数

JasperReports:未找到CONCATENATE函数

我正在使用Jaspersoft Studio开发一些报告.
我有一个应该接受REST查询的Web应用程序,并将它们转换为已编译的报告.
所以我有一些JasperReports罐子包括:

  • Groovy的全2.0.1.jar
  • iText的,2.1.7.js2.jar
  • JasperReports的-5.2.0.jar

问题是,当我编译我的报告并从Jaspersoft Studio运行时,它运行正常.
但是当我从我的Web应用程序编译并运行它时,它会抛出异常:

net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : 
    Source text : CONCATENATE($V{startString}, "  -  ", $V{endString})
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:244)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
...
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Function CONCATENATE not found
Run Code Online (Sandbox Code Playgroud)

当我CONCATENATE在报告中更改我的呼叫时,它工作正常.

所以这给我留下了一个解决方案,我错过了一个JasperReports罐子,但是哪个?

java groovy jasper-reports

8
推荐指数
1
解决办法
6017
查看次数

在jasperReport文件中出现错误

首先,我在iReport 5.1.0中创建一个R_D1.jrxml文件.

我执行报告的Java代码如下所示:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;

public class DbReportFill{

  Connection con;
  public void generateReport() {
    try {
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sentiment","root", "abcd");
      System.out.println("Filling report...");
      JasperFillManager.fillReportToFile("/home/abcd/report/R_D1.jrxml",new HashMap<String, Object> (), con);
      System.out.println("Done!");
      con.close();
    } catch (JRException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }

  public static void main(String[] args) {
    new DbReportFill().generateReport();
  }

}
Run Code Online (Sandbox Code Playgroud)

当我执行该类时,我得到以下异常:

Filling report...
net.sf.jasperreports.engine.JRException: Error loading object from file …
Run Code Online (Sandbox Code Playgroud)

java jasper-reports

8
推荐指数
1
解决办法
2万
查看次数

Git 错误:RPC 失败;HTTP 413 curl 22 请求的 URL 返回错误:413 请求实体太大

我得到了413 Request Entity Too Large错误运行此命令后:

git push -u test1 current-repo --force
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

这个错误的原因是什么?如何避免这个错误?

git

8
推荐指数
2
解决办法
2万
查看次数