Dear all,

I am doing downloadLink , when the file is existed, it is ok to download it,
but when the file is not existed, no any error message "No file exist!" to
popup!

According to debug, i can see it already  go to the line:
target.appendJavascript("alert('No file exist!')");

the codes is below,

any suggest?

thanks you  for help.


        File file = new File("C:/Documents and
Settings/cw/Desktop/Advertiser_csv/AdSmart/2008/B-ONE FLORIST (SHAW
TOWER)_m_2008_12.csv");
        form.add( new CustomDownloadLink("donld", file));



public class CustomDownloadLink extends DownloadLink {

    private static final long serialVersionUID = 1L;
    private File file;

    @Override
    public void onClick() {
        if (file.exists()) {

            super.onClick();
        }
    }

    public CustomDownloadLink(String id, File file) {
        super(id, file);
        this.file = file;

        add(new AjaxEventBehavior("onclick") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target) {
                if (!CustomDownloadLink.this.file.exists()) {
                    target.appendJavascript("alert('No file exist!')");
                }
            }
        });
    }
}
-- 
View this message in context: 
http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21307695.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to