aspose file tools*
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
Author

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" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<description>Session Bean</description>
<display-name>ActSchedule</display-name>
<ejb-name>ActualScheduling</ejb-name>
<home>FRP.masters.bean.actschedule.ActScheduleHome</home>
<remote>FRP.masters.bean.actschedule.ActScheduleRemote</remote>
<ejb-class>FRP.masters.bean.actschedule.ActScheduleBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/ClientDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>ActualScheduling</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

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

kalai
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.:-)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Writing a file