• Post Reply Bookmark Topic Watch Topic
  • New Topic

.war file

 
Jahnvi Vyas
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In my web application I want to create some .txt files after creation of .war file. Let me explain it.

In my web application I am allowing users to perform certain some actions. User has nothing to do with this .txt file. I want to create these .txt files for my purpose only. But once .war file is created and my application is deplyoed is it possible to dynamically create .txt files?? If it is possible than where to store these .txt files and what may be the steps??

Thanks..

Jahnvi
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, it is possible. Simply have your JSP (there are better ways to do this than in a JSP, but we're in the JSP topic) create a file using the standard java libraries.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on how your app is deployed, you may or may not be able to write to the application's directory structure.

A truly portable solution would be to use a directory that is outside of your webapp's directory structure. You can make the path to this directory configurable by setting it up as a context init param.
 
Jahnvi Vyas
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rusty.
 
Jahnvi Vyas
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben.

Can U just explain which kind of setting should be done in a context param??

Thanks..

Jahnvi
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OP
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UseRealWords

Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

The setting would be the fully qualified path to the directory that you want to use for reading/writing your text files.


-Ben
 
Jahnvi Vyas
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Ben.

I am usually using such abbrevations but I take care while posting messages on JavaRanch. But this time in hurry I made mistake.

I will take care in future.

Thanks..

Jahnvi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!