cancel
Showing results for 
Search instead for 
Did you mean: 

File download uielement resource attribute

Former Member
0 Kudos

Hello,

I am following the blog [link|http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproforJava-+FileDownloadUIElement]

this works fine except for the fact that resource attribute is indeed needed for filedownload element coz it otherwise gives a dump

so how should I populate the resource ? if i just simple keep a resource type attribute then the dump is gone but there is no file.

thanks in advance

B

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If you are using 7.0 then you need to bind the file download ui to an attribute of type binary and if you are using CE 7.1 then ui must be binded to an attribute of type Resource.

The best way to set the binary attribute is

wdContext.currentContextElement().setBinary(str.getBytes());

And for CE 7.1, set the Resource attribute like

IWDResource resource = WDResourceFactory.createResource(str.getBytes(), "MyFile", WDWebResourceType.TXT);

wdContext.currentContextElement().setResource(resource);

Regards,

Amol

Answers (2)

Answers (2)

bhakti2
Active Participant
0 Kudos

thank you very much for response

following code worked.

i really appreciate all the help

i have rewarded points.

IWDResource resource = WDResourceFactory.createResource(str.getBytes(),

"MyFile", WDWebResourceType.TXT);

wdContext.currentContextElement().setResource(resource);

Former Member
0 Kudos

Hi,

the easiest method is to create String (i.e. str) variable, populate it with any text you with,

and then a line of code:


wdContext.currentContextElement().setFileResource(str.getBytes());

Regards,

--

Przemysław