Roll your own link:

        Link<File> downloadLink = new Link<File>("yourID",
yourModelThatReturnsAFile) {
            private static final long serialVersionUID = 1L;

            @Override
            public void onClick() {
                File file = getModelObject();
                if (file.exists()) {
                    IResourceStream rs = new FileResourceStream(file);
                    getRequestCycle().setRequestTarget(new
ResourceStreamRequestTarget(rs));
                } else {
                    error(getString("nonexistent-file"));
                }
            }
        };

That code is mostly copied from DownloadLink.


-- 
Jeremy Thomerson
http://www.wickettraining.com

On Wed, Jan 7, 2009 at 1:35 AM, wch2001 <wch2...@hotmail.com> wrote:

>
>
>
>
> I use DownloadLink, when file is not existed, there is not any info
> message.
>
> how to solve it?
>
> I want to show some message like "No file finds" when the file is not
> existed
>
> thanks a lot
>
>
>
> Jeremy Thomerson-5 wrote:
> >
> > Well, interestingly enough, I still fail to find a question in your
> > question.  Maybe a little more code and an accurate description of your
> > problem would help us give you a more sane answer, which we'd happily do.
> >
> > On Wed, Jan 7, 2009 at 12:19 AM, wch2001 <wch2...@hotmail.com> wrote:
> >
> >>
> >> My question is
> >>
> >> 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!')");
> >>
> >>
> >>
> >>
> >> John Krasnay wrote:
> >> >
> >> > It was a bad joke. You asked for suggestions but didn't explain what
> >> > your problem was.
> >> >
> >> > jk
> >> >
> >> > On Tue, Jan 06, 2009 at 07:51:25PM -0800, wch2001 wrote:
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21324403.html
> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >>
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21325599.html
> >>  Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Help%2CDownloadLink%2C-when-file-is-not-existed%2C-not-error-message-tp21307695p21326180.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to