Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How Save File in Directory and path of the file in database using Struts 2.0 and Ejb 3.0

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.......

I have save the file in directory. before saving the file i have to also check directory for particular file is exist or no.
if exist save the file in existing directory and if no then create new directory and save the file.

Also i want to know how give file name when saving.

please help me.

thanks
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

It's not clear what you're asking; how to upload files? How to use basic Java file IO?
 
Deepak Kumar pandey
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Welcome to JavaRanch!

It's not clear what you're asking; how to upload files? How to use basic Java file IO?



I have to save file in directory and path of the file in data base using struts 2.0.
Also create directory if not exist.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So there are several parts to this task. I need to know which parts you're having problems with.

1) Upload a file (the only Struts-related problem)
2) Using Java to determine if a file exists
3) Writing information to a database

They're all different, they're all completely unrelated, and only item 1) is Struts-related.

See the Struts 2 FAQ entry about uploading files and the Struts 2 file upload page for item 1).

For the rest, I'd ask 2) in the beginning Java forum. For 3) it depends on how you're accessing the database, but either the JDBC forum, the ORM forum, or the Spring forum (or a different one if none of those cover what you're using).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic