jpy
jpy

Reputation: 3

Struts 2 stream result download when no data is available

I am trying to dynamically generate a file for user to download depending on the records in database. I have successfully done this by using stream result.

The problem is, when there is no data available to download, I want to show a dialog in the browser to tell the user 'No data available'.

Can anybody tell me how should this be done? When there is no data, the input stream to download is null and there will be exception..

Thanks

Upvotes: 0

Views: 209

Answers (1)

Dave Newton
Dave Newton

Reputation: 160211

You would use a different result and handle notification on the client side. There are any number off ways to simulate a dialog box via HTML and JavaScript, or you could use plain HTML.

Upvotes: 1

Related Questions