cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying a HTML file

Former Member
0 Kudos

Hi all,

I want an application which has various links and on clicking the links they should open html pages on the same window. can anyone please let me know how this can be achieved.

Thanks in advance

Srikant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use IFrame UiElement and set the source attribute to a contextattibute.

Change the value of the context attrib on selection.

Regards, Anilkumar

Former Member
0 Kudos

Hi,

Instead create a HTML file inside the proj folder itself.

Get the value from the context attribute and then write it in the file.

Now give the file name with extension as the source for the IFrame UI.

Regards

Bharathwaj

Former Member
0 Kudos

Hi Anil

I have mapped the context attribute to the IFrame element, but i have to map that context attribute to something which calls the static file.

I'm not able to understand:

1. how do I call the static file

2.how to change the value of context attribute onSelection.

Can you be more specific.

Thanks in advance

Srikant

Former Member
0 Kudos

Hi,

Doesnt my answer address this issue. Have a look at it again !

Use fileooutputstream and write the file in a location .Lets say the file name is abc.html

Now go the IFrameUI and give the source as abc.html.

P.S . In this case the file should be placed under the mimes/components/ur componentpackage name folder

See this code ..

File f = new File"temp
webdynpro
web
local
<proj name>
Components
?<proj comp folder>
abc.html");

try {

FileOutputStream fo = new FileOutputStream(f);

fo.write(wdContext.currentContextElement().getFileData());

fo.close();

}

catch (Exception e) { wdComponentAPI.getMessageManager().reportWarning(""+e.getCause());

}

Regards

Bharathwaj

Message was edited by: Bharathwaj R.Code Snippet added

Former Member
0 Kudos

Hi Bharathwaj,

I'm not able to understand the part

"<i><b>Get the value from the context attribute and then write it in the file.

Now give the file name with extension as the source for the IFrame UI</b></i>"

Can you explain it more?

Thanks in advance

Srikant

Former Member
0 Kudos

Hi,

If you follow the method i have suggested you dont have to create a http alias.

only the content of the file changes.you can store the file name in one atribute and map it to the source.

Or go to visual admin and create a http alias and use it

Former Member
0 Kudos

hi Bharathwaj

You suggested me to include the html file in the project. I'm unable to do that. Can you please let me know how to do that?

The html file is on my comp and i have to include in the projcomponent folder, how we gonna do that?

Thanks in advance

Srikant

Former Member
0 Kudos

Hi,

Go to the navigator tab,

OPen the project -> src-> mimes->Components-> your comppnent packagename inside this paste that html file an give the name of the html file in the source property.

Former Member
0 Kudos

hi Bharatwaj

well i have included the file in the project folder, but the code snippet which u have mentioned.

"fo.write(wdContext.currentContextElement.getFileData())"

write() function is only applicable for the integer types and not string type.

Any suggestions on that.

Thanks in advance

Srikant

Former Member
0 Kudos

Use getFileData().getBytes().

Former Member
0 Kudos

hi Bharathwaj

i give bird's view of my application:

___________________________ ________________________

<u>Click to link</u>

->

Html displayed

__________________________

_______________________

well you have the link which has to be clicked and the html page gets displayd on same window.

Now,Using IFrame Element:

1. I have included the created HTML file in the project folders

2."<b><i>Get the value form context attribute and then write it to file<i><b>"

now how do u resolve this issue as i'm not able to display data after the code in the IFrame UI Element

3. Given the file name as source to IFrame UI Element

Now, Using LinkToURL Element:

I had linked the location of file with context attribute, yet i'm unable to do display the file still.

Is this problem resolvable?

Thanks in advance

Srikant

Former Member
0 Kudos

Hi Venkat,

I would suggest you create http alias for the html pages using the Visual Admin and just provide the url in the Iframe source.

I feel this would rather simplify the whole thing I believe.

Regards

Noufal

Former Member
0 Kudos

Hi,

First put a HTML file in that path i had mentioned.

Now jus give the name of the file in the IFrame source.

This should display the html page.

If its not coming you are putting it in the wrong folder.

Just do this ! Your HTML gile should be displayed.

Former Member
0 Kudos

Hi,

I have used the methods:

1. Link to Action and the IFrame -> The Result was the html file I was able to display in the same window.

2. Link to URL -> The Result was html file opened in different window.

3.IFrame and attaching the file in project -> it was resulted in html file getting dispalyed in IFrame.

Now if I want to extend the functionality for PDF or word document. Is the logic same.

Any thoughts on this.

Thanks in Advance

Srikant

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Venkat,

You have to create HTTP Alias first and then give that url in the reference of linkToUrl either at runtime or design time.

There is a weblog on how to create http alias the link is as below.

/people/renjith.andrews/blog/2005/03/31/creating-an-http-alias-in-was

Regards,

Jaydeep

Former Member
0 Kudos

Instead of linkToUrl I would suggest you to use 'Link to Action' and set the http value to the context attribute that is bound to the source of the IFrame

Former Member
0 Kudos

Hi,

Please try this.

FileWriter writer= new FileWriter("FileName");

BufferedWriter mfWriter = new BufferedWriter(writer);

mfWriter .write("");

regards, Anilkumar

Former Member
0 Kudos

Hi,

Please place the file under "\src\mimes\Components\<Componentpackagename>\.html

Regards, Anilkumar

Message was edited by: Anilkumar Vippagunta

Former Member
0 Kudos

Hi Venkat,

You can use linkToUrl UI element. In the reference property give the path of html file you want to open. You can do this at the design time or through mapping an attribute of string type to the reference property and setting that atribute at runtime.

Hope this helps.

Regards,

Jaydeep

Former Member
0 Kudos

Hi Bharatwaj and Jaydeep

The issue has been resolved.

Thanks everybody

Srikant

Former Member
0 Kudos

Hi Jaydeep

The linkToURL UI Element i have mapped the attribute to string type and then set the attribute at runtime.

my code snippet is -->

<i>target = "the path of the file on my comp";

wdContext.currentContextElement().setTargetURL(target);</i>

targetURL is the attribute.

it is not opening the link.

Can u tell me where i'm going wrong?

also i would like to know how do you add the HTML file in the project folder? as i'm not able to add that file in mimes/...

Can some one help me on this?

Thanks in advance

Srikant

Former Member
0 Kudos

Create an http alias for the Html file.

Give the path in your Iframe.

This will open the html file for you.

For creating http alias go to Visual admin http provider and create an alias