cancel
Showing results for 
Search instead for 
Did you mean: 

Display Pre-Formatted HTML via Web Dynpro

Former Member
0 Kudos

Hi,

Does anyone know of a way to display preformatted HTML via web dynpro, can any of the standard UI elements do this?

Thanks in advance,

Simon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

can you explain what do you mean by HTML string? is it binary data that you have?

if it is a binary data i.e. in bytes then you can do this way also..

Store the binary data in a context varaible named Data and to store the url to be generated, create another context variable Url;



String formattedStr = wdContext.currentContextElement()
    .getData();
try
{
  IWDCachedWebResource resource = WDWebResource.getWebResource
  (
    formattedStr.getBytes("UTF-8"), 
    WDWebResourceType.HTML
  );
  resource.setResourceName("<Give a filename>");
  resource.setAttachement( false );
  resource.setReadOnce( false );
  wdContext.currentContextElement().setUrl
  ( 
     resource.getAbsoluteURL() 
  );
}
catch (Exception ex)
{
  wdComponentAPI.getMessageManager()
    .reportException( ex.getMessage, false );
}

Set source of the Iframe as context variable Url.

regards,

Mahesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Simon,

Please check my weblog entry dedicated to this issue:

/people/valery.silaev/blog/2005/11/23/display-formatted-text-using-webdynpro-for-java

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Thank you both for your answers.

I think this will solve the problem until a more suitable control is available.

Valery, can you tell me how long the resource object (of type IWDCachedWebResource) you create persists for and if it only exists in memory during runtime or if it persists longer?

BRgds,

Simon

Former Member
0 Kudos

Simon,

The life-time of such resources definitely does not exceed application life time (you may test this with sample in blog). Probably, even shorter -- something like life time of controller, that declare Resource attribute in context.

Also it seems that resources are stored in secondary file system cache and do not "eat" much memory

Sorry, statements above are just a guess work, API docs lacking exact description of behavior.

VS

Former Member
0 Kudos

Hi,

Iframe is a standard ui element that can display html pages. Either u can put the file in the mimes folder and give the filename as source of iframe.

or you can read the file as bytes and display it in iframe, refer the below link

Former Member
0 Kudos

Thanks,

Basically I have a HTML string available at runtime that I need to display, it is not a file that I can set the src of the iFrame to point to. Can you elaborate on the second method, or do you have any other suggestions?

Thanks

Simon