default parameter values work in iReport but not on JasperServer
First let me say that my question is slightly different from some similar ones already on SO, or at least different enough that other answers are not helping me. Eg,: JasperReport parameters works in iReport but fails on JasperServer There are others dealing with timestamp problems that also haven't helped me.
I'm a newbie to JasperReports. The question linked above was solved by adding input controls to the report definition in iReport, which would then be exported to JasperServer. That much works fine for me.
My problem is with a report having a query with a timestamp parameter and an input control. I have assigned a default value of java.sql.Timestamp(0) to the parameter. Everything works fine when I open iReport and generate the report using the "Run on JasperServer" option, the input control shows up with the proper default value. However if I run the same report from a browser connection the default values don't work. The controls show up with defaults of some date, I think, in 1969. The input controls still work, can enter a value and the report runs properly, but the browser input controls don't get the default value.
I suspect the problem may arise because the input controls are defined as having datatype of datetime, not timestamp. However if that's the case I can't figure out why the defaults work fine in the input controls in iReport but not when the report is run from the browser. I've read various posts where someone has said that java.sql.Timestamp was not supported by JasperServer before ver 3.5. I'm using most recent version but I still can't figure out how to add a timestamp type to the server repository (or whether it's necessary, since things seem to work fine with datetime type other than my problem with default values).
For the current date as default you can use this function in Ireport
new java.util.Date()
it gives you current date and i have tested it also works fine with Jasper server browser.
链接地址: http://www.djcxy.com/p/18692.html上一篇: 将传递日期值传递给IReport中的参数