Sorry for not writing the code before.... Here is the code... public class GenerateReportAction extends Action { public ActionForward execute(ActionMapping mapping ,ActionForm form, HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { try { Class.forName("com.mysql.jdbc.Driver"); Connection connection=DriverManager.getConnection("jdbc:mysql:///project","root","passwordchahiye"); ServletOutputStream servletOutputStream =response.getOutputStream(); InputStream reportStream = getServlet().getServletConfig().getServletContext().getResourceAsStream("/reports/myemployee.jasper"); response.setContentType("application/pdf"); PreparedStatement preparedStatement=connection.prepareStatement ("select farmer_firstname ,farmer_lastname,farmer_address,farmer_city from farmer"); ResultSet resultSet =preparedStatement.executeQuery(); JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(resultSet); System.out.println("Filling report..."); JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream, new HashMap(),resultSetDataSource); connection.close(); servletOutputStream.flush(); servletOutputStream.close(); System.out.println("Done!"); return mapping.getInputForward(); }catch(Exception ex) { ex.printStackTrace(); System.out.println ("Report could not be generated !! "); return null; } } } I m using Action class to generate report....