cancel
Showing results for 
Search instead for 
Did you mean: 

Create Hyperlink

Former Member
0 Kudos

In HTML, you can create hyperlink.

Example:

Click <b>

<a href="http://www.google.com">

</b>here<b>

</a>

</b> to go to Google.

How to do this in WebDynpro JAVA?

Try the above way but fail.

It does not treat <b>

<a href>

</b> as hyperlink. It just treat it as string.

All Expertise here, Please advice.

Thank You.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi YuChoong,

In WebDynPro is not like JSP or HTML.

For that one you insert LinkTOURL UI element in your view.

1)Insert LinkTOURL UI element to your view

2)Create context attribute in view Context.

3)Bind LinkTOURL UI element with context attribute and Give title in text property

4)In the init() method of view implement following code

wdContext.currentContextElement().setTest("http://www.sdn.sap.com");

<b>Context Attribute Name is test</b>

This will work

Rgds

-SS

Former Member
0 Kudos

Hi SS,

Thank you for the feedback.

The way you mention is creating it in the View. Is it possible to create it in DialogBox? Because the message appear in Dialog Box. Would like to create a hyperlink there. User click on that hyperlink and can go to that new site.

Thanks,

Aaron

Former Member
0 Kudos

Hi Yu

I am not sure.This may work or not!!!!

I've inserted couple of html tags below and after the link.

Try with that one and let me know

	IIWDConfirmationDialog dialog =
					wdComponentAPI.getWindowManager().createConfirmationWindow(
						dialogText
							+ "<html><body><a href='http://www.google.com'> "
							+ dialogText2 + "</a></body></html>",
						controllerInfo.findInEventHandlers("Ok"),
						"Ok");

Rgds

SS

Former Member
0 Kudos

Thanks for the feedback SS.

However, the codes not works too. It still does not have hyperlink there. It just treat the html as string.

Former Member
0 Kudos

Hi,

Unfortunately this is not possible in WD. If you want to do this, you will have to create your own view with LinkToURL UI elements in the proper places and then call this view through:

wdComponentAPI.getWindowManager().createModalWindow(IWDWindowInfo);

Regards,

Satyajit.

Former Member
0 Kudos

Thanks for the feedback Satyajit. Can you provide coding sample on how to create using

wdComponentAPI.getWindowManager().createModalWindow(IWDWindowInfo);

Do you have any tutorial sample on this?

Thanks,

Aaron

Former Member
0 Kudos

Hi,

You can find a similar tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/exporting%20context%20data%20into%20excel%20using%20the%20web%20dynpro%20binary%20cache.pdf">here</a>.

Regards,

Satyajit.

Former Member
0 Kudos

Hi YuChoong,

Pls refer to Page 8 and 9 for creating external windows.

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/wd%20java/wd%20tutorials/dialog%20boxes%20in%20web%20dynpro%20applications.pdf">Sample Tutorial</a>

Regards,

Alka.

Former Member
0 Kudos

Hi,

Hi,

The confirmation dialog is a Inbuilt functionality of Webdypro.Yo cannot add UI elements to it.Only buttons are added that too dynamically depending on the choice provided.

Instead you can do it otherway.

Let the name of view from which the popUp has to intiated be "MainView" with action "OpenPopUp"

1.Create a new window say "ConfirmWindow"

2.Create a view say "ConfirmView" under window ConfirmWindow.

3.Set the view layout as GridLayout with colcount = 1

3.Add a Group UI element to view ConfirmView.

4.set the group's property as below

"design" to sapcolor and layout to Gridlayout with colcount =2 (colcount depends on the UI elements you want to add. in the present case it will look like <text> <hyperlink>)

5.To set a title of the pop up set the appropriate value of the property "text" of UI element Group_header under group.

6.Now add a textview and LinkToURL UI elements to Group.

7.Now set the "text" property of textview to the value that you wanted to see as dialogtext

8.Set the "text" and "reference" property of the LinkToURL to "<text you would like to see>" and URL repectively.

9.Create a button say "Ok" mapped to a action onActionOK under group with colspan = 2 and halign = center.

10. Create a context node say "PopUp"(cardinality 1..1) in the component controller and a attribute say WindowInstance of type com.sap.tc.webdynpro.services.session.api.IWDWindow (java native type).Map this attribute to both the views.

10.In OpenPopUP action of MainView

IWDWindowInfo windowInfo = (IWDWindowInfo)wdComponentAPI

.getComponentInfo()

.findInWindows("ConfirmWindow");

//create the “ConfirmWindow”

IWDWindow window = wdComponentAPI.getWindowManager()

.createModalWindow( windowInfo, true);

//set the WindowPosition on the screen

window.setWindowPosition(300, 150);

//and show the window

window.show();

// Save WindowInstance in Context

wdContext.currentPopupElement().setWindowInstance(window);

11.inside onActionOK in the ConfirmView

IWDWindow window = wdContext.currentPopUpElement().getWindowInstance();

window.destroyInstance();

Note : In this scenario we are opening a view will be opened as a popUp.

In the view you can click on the link and the URL will be opened in a new window.

But on click of the hyperlink the popup will not be closed.

If you click on the OK button the popup will be closed.

Message was edited by:

Shriram Kabra

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

U can use either button or LinkToAction UI element

First u have to create outbound plug in interfaceview

1)Open the node WebDynpro &#8594; Web Dynpro Components &#8594; <ComponentName> &#8594; Component Interface &#8594; Interface Views in that click <interfacename> interface view .

2) Select the Plugs tab in the Plugs area.

3)Choose New next to the outbound plug table.create new outbound plug.for example,Name GotoUrl, and choose Type Exit Plug.

4)Select the new outbound plug GotoUrl and choose New next to the parameter table.taEnter the name Url datatype as STRING.

5)Open the view in the View Designer and select the Properties tab. Choose Add next to the Required Controllers table and add the <interface name>InterfaceView

Place 1 button and check,

onActionButton write this code

{

wdThis.wdGetSampleInterfaceViewController().wdFirePlugGotoUrl(

"http://www.google.com");

}

In Below Application this concept used refer page no.20 and 29

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4a417a90-0201-0010-f499-8d41fc78...

Regards,

Suresh.T

Former Member
0 Kudos

Hi YuChoong,

For creating <b>Hyperlink</b> there is a UI element called as LinktoURL in Web Dynpro.

You have to use <b>TEXT and REFERENCE</b> properties to set the display text

and URL for the link respectively.

Hope it helps.

Regards,

Alka.

Former Member
0 Kudos

Alka,

Thanks for the quick response.

Actually created messages in a dialog box. In here, there's URL provided. And want user click on it, bring to that page.

Here is the source code looks like. Would like to make dialogText2 string as hyperlink.

IIWDConfirmationDialog dialog =
				wdComponentAPI.getWindowManager().createConfirmationWindow(
					dialogText
						+ "<a href='http://www.google.com'> "
						+ dialogText2 + "</a>",
					controllerInfo.findInEventHandlers("Ok"),
					"Ok");
dialog.open();

Please advice.

Thank you.