cancel
Showing results for 
Search instead for 
Did you mean: 

How to open an HTML page from web dynpro application

Former Member
0 Kudos

Hi All,

I need to display an HTML page, which provides some information to user, when user clicks on a link or button. I have made the required HTML page. But I dont know how to open that page from the web dynpro application and where to keep that page.

Please provide me some useful guideline.

Regards,

Bhargav

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi Bhargav,

Use IFrame UI element and set its source property to HTML page.

Regards,

Siva

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Bhargav,

Hope this [thread|] will help you to solve your problem.

Thanks

Ritushree Saha

Former Member
0 Kudos

Hi.

import some API in you view--codding

import com.sap.tc.webdynpro.services.sal.url.api.WDWebResource;

import com.sap.tc.webdynpro.services.sal.url.api.WDWebResourceType;

import com.sap.tc.webdynpro.services.session.api.IWDWindow;

import com.sap.tc.webdynpro.services.session.api.WDWindowFeature;

Create one method as displayPrint() and create one action for click on button as ShowHTML action for show button

and create one Context value attribute as Htmlcontent set as TYpe-Binary

goto attribute click on itlook at TYPE property of attribute as change string to Binary

Create Two extra method in View...

In VIEW--

public java.lang.String displayPrint( )

{

//@@begin displayPrint()

StringBuffer htmlcontent=new StringBuffer();

htmlcontent.append("<html><body>");

htmlcontent.append("<input type=\"text\" name=\"su\" >");

htmlcontent.append("<input type=\"text\" name=\"se\" >");

htmlcontent.append("<input type=\"submit\" name=\"sre\" value=\" show\" >");

htmlcontent.append("</html></body>");

return htmlcontent.toString();

//@@end

}

In View--

public void onActionShowHTML(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

byte[] content = new byte[4028];

try {

content = this.displayPrint().getBytes("UTF-8");

wdContext.currentContextElement().setHtmlcontent(content);

// Where content is loaded with data from displayPrint() method, which is holding the HTML *page to be displayed to the user *

IWDWindow win =wdComponentAPI

.getWindowManager()

.createNonModalExternalWindow(WDWebResource

.getWebResource(content, WDWebResourceType.HTML)

.getURL(),"ShowVideo");

win.setWindowSize(445,460);

win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);

win.removeWindowFeature(WDWindowFeature.TOOL_BAR);

win.removeWindowFeature(WDWindowFeature.MENU_BAR);

win.open();

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException ("Unable to open window"+e,false);

}

}

thanks

jati

Former Member
0 Kudos

Hi,

Create a Non Modal window and give the link.

IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow("http://google.com");

window.show();

Jithin

pravesh_verma
Active Contributor
0 Kudos

Hi Bhargav,

The best way is to use the IFrame UI element. You can do one thing as you have said " I have made the required HTML page.", so you can just store that HTML page in the local server location or even in the project struture, and set the IFrame Ui element's source property to this HTML page.

Doing this will show you HTML page in this IFRAME.

I hope this helps

Thanks and Reagrds

Pravesh

Former Member
0 Kudos

Hi Pravesh/Siva,

Thanks for the informative reply.

But in my application I want the html page to be displayed in a separate window.

Can it be possible?

Regards,

Bhargav

Edited by: bhargav joshi on Mar 12, 2009 9:55 AM

former_member185086
Active Contributor
0 Kudos

Hi

If u want to navigate to external HTML like google ,gmail etc So user linkToURL UI Element and provide the URL , Try same for custom URL which is with you.

Best Regards

Satish Kumar

Former Member
0 Kudos

Hi Satish,

Thanks for the information.

I have tried LinkToURL option. But I am not able to open the html page I have created.

What path shold I give if the page is in D drive, and XYZ folder.

Can you please explain in bit detail.

Regards,

Bhargav

pravesh_verma
Active Contributor
0 Kudos

Hi Bhargav,

You can try giving the local path in the non modal window parameter. Please note that this webdynpro application will not pick the page from your local directory if you are using this kind of approach (i.e.: Non modal Window). It will always pick the page from the server directory. If you place the html file in the server directory and then give its reference, You will be able to view that HTML page.

Also try to use this:


"<Your_Machine_Name>\\D:\\Name_of_YourFile"; 

.... may be this works!!

I hope this helps.

Thanks and Regards,

Pravesh

Edited by: Pravesh Verma on Mar 12, 2009 5:10 AM

former_member197348
Active Contributor
0 Kudos

Hi Bhargav,

Use LinktoAction UIElement instead of LinkToURL, create an action and bind this to onAction event,

In implementaion, write

wdComponentAPI.getWindowManager().createNonModalExternalWindow(URL, title);

Regards,

Siva

Former Member
0 Kudos

Hi,

Please try the code which i have posted before.. it will solve your problem

Jithin

former_member185086
Active Contributor
0 Kudos

Hi

See this [thread|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/903fed0d-7be4-2a10-cd96-9136707374e1] for further input.

Best Regards

Satish Kumar