This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I've some data coming in the request of a servlet from Flex front end. I've to write code to create a temp folder in my application context and save that data from request to temporary file in this temp folder. Can anybody guide me on how do i create file names from java code.
Thanks Jesper, I've named the file by appending the time stamp to a string. Now my application is deployed in Tomcat server in my sandbox setup & will be deployed in WAS in production. I need to place these files in some folder say temp in my application root(something like: /webapps/appname/temp). i don't know how doo i point to that location.
Originally posted by Ruchee Goyal: I've named the file by appending the time stamp to a string.
This sort of thing is a bad idea. It works most of the time, but you can easily get occasional errors when two files happen to get created with the same time-stamp. Computers are easily fast enough to process more than one during a particular millisecond.
Use createTempFile() as suggested. If you really can't do that, use a serial number or something like that, but not timestamps.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.