PDA

View Full Version : Empty report with Jasper


fsadiego
Aug 14th, 2007, 12:35 PM
Hi,

I trying do use Jasper with Spring MVC but after processed, the report still empty without an apparent reason.

Aanybody know what the problem could be? tks

My controller is:

...
public ModelAndView viewReport(HttpServletRequest request,
HttpServletResponse response) throws Exception {

logger.debug("*** " +this.getClass().getName());

Map<Object,Object> model = new HashMap<Object,Object>();
List<Exception> exceptions = new ArrayList<Exception>();
model.put("fullName", "Testname");


return new ModelAndView("reportView",model);
}

the config (views.properties) ...

reportView.class=org.springframework.web.servlet.v iew.jasperreports.JasperReportsHtmlView
reportView.url=/WEB-INF/report/relatorio2.jrxml

that's the log:

[DEBUG,DispatcherServlet,http-8080-2] Rendering view [org.springframework.web.servlet.view.jasperreports .JasperReportsHtmlView: name 'reportView'; URL [/WEB-INF/report/relatorio2.jrxml]] in DispatcherServlet with name 'spring'
[DEBUG,JasperReportsHtmlView,http-8080-2] Rendering view with name 'reportView' with model {fullName=Testname} and static attributes {}
[DEBUG,JRBaseFiller,http-8080-2] Fill 27531292: created for relatorio2
[DEBUG,JRBaseFiller,http-8080-2] Fill 27531292: filling report
[DEBUG,JRVerticalFiller,http-8080-2] Fill 27531292: no data
[DEBUG,JRVerticalFiller,http-8080-2] Fill 27531292: no pages
[DEBUG,JRBaseFiller,http-8080-2] Fill 27531292: ended
[DEBUG,DispatcherServlet,http-8080-2] Cleared thread-bound request context: org.acegisecurity.wrapper.SavedRequestAwareWrapper @7df60a
[DEBUG,DispatcherServlet,http-8080-2] Successfully completed request
[DEBUG,XmlWebApplicationContext,http-8080-2] Publishing event in context [org.springframework.web.context.support.XmlWebAppl icationContext@50ca0c]: ServletRequestHandledEvent: url=[/intranet-buscape/protected/advertising/advertising-report.html]; client=[127.0.0.1]; method=[GET]; servlet=[spring]; session=[9735BCDA324327404565611A00573222]; user=[alice]; time=[16ms]; status=[OK]
[DEBUG,XmlWebApplicationContext,http-8080-2] Publishing event in context [org.springframework.web.context.support.XmlWebAppl icationContext@110fe28]: ServletRequestHandledEvent: url=[/intranet-buscape/protected/advertising/advertising-report.html]; client=[127.0.0.1]; method=[GET]; servlet=[spring]; session=[9735BCDA324327404565611A00573222]; user=[alice]; time=[16ms]; status=[OK]
[DEBUG,ExceptionTranslationFilter,http-8080-2] Chain processed normally
[DEBUG,HttpSessionContextIntegrationFilter,http-8080-2] SecurityContextHolder set to new context, as request processing completed

noon
Aug 14th, 2007, 02:57 PM
Don't know does this fix the problem, but it's preffered to use the compiled jasper files instead of the jrxml file (in your views.properties-file).

fsadiego
Aug 14th, 2007, 03:09 PM
I've found that as the answer :

http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/FAQ15

Changing the way I set the model everything looks fine.


public ModelAndView viewReport(HttpServletRequest request,
HttpServletResponse response) throws Exception {

logger.debug("*** " +this.getClass().getName());
Map<Object,Object> model = new HashMap<Object,Object>();

ArrayList<User> users = new ArrayList<User>();

User user = new User();
user.setFullName("TestName");
users.add(user);

model.put("Users", users);

return new ModelAndView("reportView",model );
}