on 01-28-2009 11:44 AM
hi,
I've created one link to action . while clicking the link I need to fetch the values from the oracle database and populate it into .txt file.
I need to use one separate java class for fetching the values from the database and keep it inside the .txt file.
I am able to fetch the data from oracle database.But not able to populate in the .txt file which will be the popup onclick of the link.
Please provide some code.
Regards
Vineela
Please have a look at below link for complete steps to display data in flat file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Vinod,
I tried with your code.It's working for .doc file.Means popup is coming with the word.But I want to display the values with the popup in .txt format.When I tried with the .txt file,values are stored in the IE browser.
And one more thing is I need to use tab and new line character inbetween the values.
Can you please give me any solution for this
Regards
Vineela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Vineela,
For Spaces, Tabs and Newline, use escape sequences like \t, \n. I am able to see the data in pop-up window external pop-up window in txt format. May be you should try some plug-ins for IE or try the same in some other browsers.
Note: try some other WDWebResourceTypes; for getting data in txt format, use WDWebResourceType.TXT
vinod v
Hi Vineela,
Using the Java IO will only write the file on the server. You have to use the IWDResource Java type context attribute and use the download function. Information is there in this [tutorial.|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71]
Regards,
Sanyev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have all the data in your context from Oracle DB. Jut to display those contents in Text file use the following code.
IPrivateExperimentView.IDetailsNode dnode;
StringBuffer buf = new StringBuffer( "");
for( int i = 0; i < wdContext.nodeDetails().size(); i++)
{
buf.append( wdContext
.nodeDetails()
.getDetailsElementAt( i)
.getName() + " \n");
}
IWDResource res = WDResourceFactory.createResource( buf
.toString().getBytes(), "Test.txt", WDWebResourceType.TXT);
wdComponentAPI
.getWindowManager()
.createNonModalExternalWindow( res.getUrl( 0), "test.txt").show();
This will open a text file with data from context node.
vinod v
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Narendra,
We are able to create the file into the server.Could you help us by sending the code for downloading file from the server and generating the popup notepad with that content.
Thanks & Regards
Vineela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vineela,
I tried the same thing but was not able to do this directly.
I did the the same procedure as i mentioned you in my previos post.
As the application hosts over server so we cannot directly store the file in your local system. You need to use file download UI element.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Narendra,
Thanks for your information.
But in our scenario on click of the link we want to generate a pop up notepad in which we want to dispaly some content. Cant we achieve this without saving in the server and downloading from there. Because anyways the user will save the notepad in his local machine later.
Thanks & Regards
Vineela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vineela,
As you are using Webdynpro application to write into the file, So what it does is it creates the file at the specified location in server only (not in your local machine.). But for storing a file on server you need to have read/write access to that folder means suppose you want to store the file at C:\File then you must have read/write access of File folder.
Now after storing the file on the server you can download that file by using download UI elements.
Hope this will help.
revert if you require more.
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Narendra,
We are also using the same code inside the java class.But while we are trying to calling from the webdynpro action method it's neither writing the data inside the specified path nor the file is not getting created.We've tried with the FileOutputStream also,it's also not working.
But If I am using simple java without using the webdynpro it's working fine.
Can you please give me the solution for this.
Regards
Vineela
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vineela,
Below is the code for writing into the file.
If the file does not already exist, it is automatically created.
try {
BufferedWriter out = new BufferedWriter(new FileWriter("C://outfilename"));
out.write("aString");
out.close();
} catch (IOException e) {
}
Hope this will help
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.