In previous post jasper report is called with the help of java bean. Now we can use a link to call report as in previous method calling report from a .jsff page gives error.
To call report using link follow following steps:
- Add a go link to page which will call servlet and also pass parameters.
- Add a command button to assign value to parameters.
- Add value in destination like “/jasperservlet?deptno=#{bindings.DepartmentId1.inputValue}&reporttype=#{bindings.Filetype1.inputValue}”.
- Here deptno and reporttype are parameters passed from url and will be used in servlet.
- To get parameter value in servlet use following code.
Integer code = Integer.valueOf(request.getParameter("deptno"));
String reporttype = request.getParameter("reporttype");