cancel
Showing results for 
Search instead for 
Did you mean: 

Reading and writing files in a folder in WAS.

Former Member
0 Kudos

Hi

I want to write a file to a specific folder in the application server and also i want to read the same using Web Dynpro for Java.Plz help me on this.

Thanks

Renu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

to Write a file onto the server

blic void Write_Data_ToTextFile( )
  {
    //@@begin Write_Data_ToTextFile()
try
{
                String str1=wdContext.currentContextElement().getStr1();
                String str22=wdContext.currentContextElement().getStrr2();
FileWriter fil = new FileWriter(new File("D:/MyData.txt"));// Path where file to be written. This path will be where the J2EE server is installed
BufferedWriter bu= new BufferedWriter(fil);
                bu.write("String 1="+str1);
                bu.newLine();
                bu.write("String 2="+str2);
                bu.close();
               }
               catch(Exception e)
{}

Best Regards

Chaitanya.A

Former Member
0 Kudos

Hi,

You have to use the IO Package for this. Their is nothing specific to webdynpro.

Please have a look at the following links for reading and writing files in java

http://www.roseindia.net/java/beginners/java-write-to-file.shtml

http://www.javapractices.com/topic/TopicAction.do?Id=42

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyappa,

Thanks for ur prompt reply. But i want to upload a file through WD Fileupload UI element write it to a specific folder in WAS.

Renu

Former Member
0 Kudos

Hi,

Please go through this

Regards

Ayyapparaj