It's not a secret anymore!
The moose likes Beginning Java and the fly likes Writing a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Writing a file" Watch "Writing a file" New topic

Writing a file

kalai sundar
Ranch Hand

Joined: May 25, 2005
Posts: 69
My problem is i want to write a file with file name as ejb-jar.xml.when i click save button in my program, the follwoing content

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "">
<description>Session Bean</description>

should be saved in the file with name as ejb-jar. for some tag i am geting vales from the user, so those values wgich i get from text bos has to be placed in bettween tag, how to write in to the file ejb-jar, can u give me sample code

Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
you can write it the same way you write to any file.
you use a string object to write to a file.
just make the string the way you want it with the values which you want.
i am sure you know how to build the string which you want.

Life called,so here I am.<br />Cheers<br />Niki.:-)
I agree. Here's the link:
subject: Writing a file
It's not a secret anymore!