on 09-24-2007 1:40 PM
Hi!
I am just learning java web dynpro and have the following problem:
I have a variable of type String which is filled with a complete description of a html site. Now I want to show this html-site.
I tried to use an IFrame, but I think it's not possible to use a context-variable as a source which consists of html-conding. I need a url, right?
My question: What is the easiest way to show the content of the variable in an IFrame or something else?
Thanks and regards,
Dominik
Hi,
You can create an empty HTML file under the mimes folder in the component. Put this file URL as the reference of the IFrame. Once you have got the HTML string, you can open this file and write the string to this file.
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I think there is a missunderstanding.
I want to show a html-page which consists of the html-coding which is stored in the integer-variable.
I tried to write the information from the variable into the file in following way, but it doesn't work, the file is empty:
try{
// Create file
FileWriter fstream = new FileWriter("MailPreview.html");
BufferedWriter out = new BufferedWriter(fstream);
out.write(wdThis.wdGetHtmlMailController().DummyText());
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
Regards, Dominik
Hi,
I tried another way, but it doesn't work yet.
The file (Mail.html) is not getting updated.
try {
wdContext.currentContextElement().setMailPath(WDURLGenerator.getWebResourceURL(wdComponentAPI.getDeployableObjectPart(), "Mail.html"));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter (new FileOutputStream(wdContext.currentContextElement().getMailPath() ) ) );
out.write(eMailContent.getHtmlCode());
//out.newLine();
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
Hi Mithu,
showing the content of the file in an IFrame works perfect.
My problem: I have to edit/clear the html-code in the file during the application is running. Therefore I have to overwrite the exsisting content of the file, but my coding (see above) doesn't work.
Do you have any idea?
Thanks and regards,
Dominik
Not sure if these classes are already contained in your Web Dynpro version, but something like this should work:
IWDTransparentContainer root = (IWDTransparentContainer) view.getRootElement();
IWDIFrame frame = view.createElement(IWDIFrame.class);
root.addChild(frame);
String html = "...";
IWDCachedWebResource res = WDWebResource.getPublicCachedWebResource
(
html.getBytes(),
WDWebResourceType.HTML,
WDScopeType.APPLICATION_SCOPE,
wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),
"page1"
);
try
{
frame.setSource(res.getURL());
}
catch (WDURLException e)
{
//TODO handle exception
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.