on 08-18-2005 6:07 AM
Hi All,
I would like to know the procedure in which you include the static HTML files in project and then displayed using both : <b>LinkToURL</b> & <b>LinkToAction</b> UI Element.
Someone suggested using the FileOutputStream.
Can someone just explain the procedure step wise how to display the HTML Files kept in project(kept in MIMES Folder) using both the UI Elements.
Thanks in advance
Srikant
Hi Venkata,
I'll offer you a solution for displaying the HTML file (stored inside the same project) through LinkToURL UI. I don't know whether this is the correct way of doing it, but it always worked for me. If someone knows a better way, please let us know. I'm listing down each step involved in this :
1) <b>copy the html page to your mimes folder</b>
Switch to Navigator view of your NWDS. In your WebDynpro project navigate to the folder src->mimes ->components -> <your component name>. paste your html file(let's say abc.html) here.
2) <b>create an HTTP alias for the server folder of your WAS.</b>
Refer the weblog /people/renjith.andrews/blog/2005/03/31/creating-an-http-alias-in-was on how to create an HTTP alias.
Create an HTTP alias for the path 'Drive:\usr\sap\<SAP SYSTEM ID><Instance num>\j2ee\cluster\server0'. Let's call the alias 'systemAlias'.
3) <b>Create a LinkToURL UI element</b>
Create a LinkToURL UI element & mapp it's 'reference' property to some attribute, say 'url_path'. set 'target' as _NONE if you need to open the page in a new window.
4) <b>Write the necesary code in your WD iview.</b>
Retrieve the path of the html page using the following line of code :
String retrieved_path = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"abc.html");
But this path starts from the server0 folder of your WAS and it starts like "./temp/webdynpro/web/local...". So we need to remove the leading dot.
String actual_path = retrievd_path.substring(1);
Now we need to append this path to the server alias to form the url of the html page.
String url = "http://<your-server-name>:50000/serverAlias"+actual_path ;
set the 'url_path' as this value:
wdContext.currentContextElement().setUrl_path(url);
This will give you the desired functionality.
I know this is a long way of achieveing a relatively small functionality. Even I would like to know a simpler way if there exists one.
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nibu,
Well if I'm keeping the files in the <components> folder, then what is the need of me creating HTTP alias. As without puttin the files in the project folder, and keepin it on server machine and giving the alias and hardcoding like this
<i>wdContext.currentContextElement.seturl("http://<servername>:<portno>/alias/abc.html");</i>
gives me the file.
Please explain me about this?
I want to know where is the default location we should put these files so that instead of hardcoding like above we can use something like this:
<i>./temp/webdynpro/...</i>
as instead of hardcoding of server i want to use alias?
and the way it suggested to pass the name in reference property, it doesn't work. Can some one suggest better method. as hardcoding is not good method.
Please suggest some method which is alternative to it??
thanks in advance
Srikant
Hi Venkat
When you create a alias it can point to any folder in your server. Well if you do no want to hardcode the server name then you can get the details of the server as follows
WDSystemLandscape.getSLDHost()":"WDSystemLandscape.getSLDPort()"/"<alias name>"/"<name of the file >
Regards
NagaKishore V
Hi Nibu and Naga,
I've followed the steps mentioned ,except instead of:
<b>WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObject,"abc,html");</b>
I'm using
<b>WDURLGenerator.getResourcePath("abc,html");</b>
I'm getting these errors:
1.The requested resource does not exist.
Details: Go to main page of this application!
on clicking main page it gives
2.You are not authorized to view the content of the requested directory.
Details: Directory listing is not allowed on this server.
Can you tell me where i'm doing the error.
Thanks
Srikant
Hi Venkat,
Use this code as Nibu said
WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"abc.html");
Regards,
Jaydeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This exception is thrown if the alias to deployable object and application couldn't be resolved.
Try accessing the file using using
http://<Server name>:<port>/<alias name>/<your file name>
If the file doesn't open then your alias is wrong otherwise it should work.
Regards,
Jaydeep
Hi Jaydeep,
You righthly said that alias is not resolved. I've already defined the alias name in the VA. But still its giving error.
My files are located in my project folder. So firstly they will be getting deployed then they will be accessible.
I have given systemAlias as HTTP Alias
<i>systemAlias = C:/usr/sap/J2E/JC00/j2ee/cluster/server0</i>
and in the <i>\temp\webdynpro\web\<proj_name>\Components\<component-name></i> folder the files have been uploaded too.
here it is <i>./temp/webdynpro/web/local/proj_name/components/component_name/</i>
So, But when i write the code
<i>WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObject(),"abc.html")</i>
its giving error of Unhandled Exception Type <i><b>WDAliasResolvingException</b></i>
but on giving following code:
<i>WDURLGenerator.getResourcePath("abc.html");</i>
its returning following message.
<i>./temp/webdynpro/web/abc.htm</i>
So as u see there is confilct when it comes to the location of the file.
How to resolve this issue?
Thanks in advance
Srikant
Armin,
I had tried that many times before going for this. Unfortunately it didn't work for me. Can you please confirm if you have used this for LinkToUrl UI?
The other alternative I found was storing the html file in the mimes folder & hardcoding the source as http://<host name>:50000/webdynpro/resources/local/<your-project>/Components/<your-component>/<your html file name>.
This hardcoding of the entire path worked fine for me, but not just giving the file name only as you said.
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1. In case of LinkToAction , place a FrameUIElement and assign the source of the frame to the html page.
2. In case of URL check the following post and assign the URL source to the http://path
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Anil,
i tried LinkToAction, placed a IFrame UI element and assgined the source of the frame to HTML page by following method.
Firstly i got the path of path of the HTML page through
<i>String path = WDURLGenerator.getResourcePath("abc.html");
wdContext.currentContextElement().setCaption(path);</i>
where Content is context element.
And the context element in the IFrame UI element is mapped to it.
but its giving error.
Can u tell me where i'm going wrong?
Thanks in advance
Srikant
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.