Ignore the previous question.... The 2 line is generate the report in pdf format. Yeah, it success. Then come to the 3rd line, it prompt me "Null" Value. SO, it that mean cant read the pdf file and then display it into the browser ?
1 Public void onSubmit() { 2 File file = exportRequestDetailsAsPdf(sqlField, sqlCondition, sqlOrderBy); 3 System.out.println("file = " +file); 4 ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(new FileResourceStream(new wicket.util.file.File(file))); 5 System.out.println("target = " +target); 6 String currentFile = System.getProperty("user.dir"); 7 String filename = "file:///" + currentFile+ "/requestMaster_created_by_userid_" + getUser().getUserId()+".pdf"; 8 target.setFileName(filename); 9 RequestCycle.get().setRequestTarget(target); 10 } 11 protected File exportRequestDetailsAsPdf(String sqlField, String sqlCondition, String sqlOrderBy) { 12 // iText code 13 } Thanks for ur help ,Harald ... :computer-user: Harald Gruber wrote: > > > try this... > > public void onSubmit() { > File file = generatePdfReport(); > ResourceStreamRequestTarget target = new > ResourceStreamRequestTarget(new > FileResourceStream(new org.apache.wicket.util.file.File(file))); > target.setFileName("Filename.pdf"); > RequestCycle.get().setRequestTarget(target); > } > > > harald > > > kenixwong schrieb: >> Once i click the "Generate Report" Button, the onSubmit function of >> button will called and generate a report in pdf format. Once the report >> is generated, i need it immediately display in the browser (either >> current page or pop up page). Anyone can help ? note: The Report is >> implemented with iText. >> ------------------------------------------------------------------------ >> View this message in context: wicket - Load the pdf file after onSubmit >> <http://www.nabble.com/wicket---Load-the-pdf-file-after-onSubmit-tf3808639.html#a10779302> >> Sent from the Wicket - User mailing list archive >> <http://www.nabble.com/Wicket---User-f13976.html> at Nabble.com. >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Wicket-user mailing list >> Wicket-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > -- View this message in context: http://www.nabble.com/wicket---Load-the-pdf-file-after-onSubmit-tf3808639.html#a10782279 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user