Thanks anyone... i get it

This is the solution :clap:



  /*********************************/
      
   Public void onSubmit() {
     ......
     ......

    exportRequestDetailsAsPdf(sqlField, sqlCondition, sqlOrderBy);
    
    String report_name = "requestMaster_created_by_userid.pdf";
                        
   File file = displayPdf(report_name);
        ResourceStreamRequestTarget target = new ResourceStreamRequestTarget(new
                                        FileResourceStream(new 
wicket.util.file.File(file)));
        target.setFileName(report_name);
        RequestCycle.get().setRequestTarget(target); 
   }

    // Generate the report
    protected void exportRequestDetailsAsPdf(String sqlField, String
sqlCondition, String sqlOrderBy) {
            // iText code
    }

   protected File displayPdf(String reportName) {
        File readFile = null;
        readFile = new File(reportName);
        return readFile;
  }





Harald Gruber wrote:
> 
> kenixwong schrieb:
>> 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 ? 
> 
>> 3            System.out.println("file = " +file);
> 
> if file is null here it looks to me like u dont return it in your 
> exportRequestDetailsAsPdf function.
> 
> for the wicket part: my hint was for version 1.3. don't know if it works
> the 
> same in 1.2.6.
> 
> but probably have a look at
> http://cwiki.apache.org/WICKET/best-practices-and-gotchas.html#BestPracticesandGotchas-Startingdownloadafterformsubmission%2528Wicket1.2%2529
> 
> there is a 1.2 version part.
> 
> harald
> 
> -------------------------------------------------------------------------
> 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#a10798589
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

Reply via email to