aspose file tools*
The moose likes Servlets and the fly likes Need help on web counter... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Need help on web counter..." Watch "Need help on web counter..." New topic
Author

Need help on web counter...

vasu devan
Ranch Hand

Joined: Apr 18, 2002
Posts: 37
Hi All,
I am having a servlet page, in that I need to generate the number in sequence and again which needs to be unique. This number is like order number and I do not want them to be duplicated. Can any one suggest me how to proceed or Is there any site that has the help for this(like web counter).
Looking forward for the reply.
Aleks V. Pascoal
Ranch Hand

Joined: Apr 21, 2002
Posts: 73
It depends on what ever you want to do with it.
You can set an attribute and increment it by listeneres...but the ideal is to put it on a database or in a file.
Aleks
vasu devan
Ranch Hand

Joined: Apr 18, 2002
Posts: 37
Hi Aleks,
Thanks for the reply. As I am not allowed to use the database and at the same time if I keep the value in the file then I need to take other precaution that when one process reading the file I should not allow the other process to access the file till I increment the value in the file.
Is there any way to do that, or can you suggest me some other option.
Thanks in Advance,
Vasu.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Aleks",
Your name still does not comply to the JavaRanch naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
sim sim
Ranch Hand

Joined: Jun 05, 2002
Posts: 55
Hi Vasu,
If u want to go with file option and u want only one thread accessing the code at a time then place the file reading part of code in a synchronized block.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help on web counter...