Hi everyone. I am new to Java and not even sure it can accomplish what I am trying to do. I have been asked to try to come up with a web based program that will create numbers in a sequential order....IE: 001, 002, 003.....upon every press of a button. I need these numbers to be able to be stored so that the next time someone else loads this up and presses the button, it will produce the next number in the sequence. It also has to work across many workstations and users. Is this even possible? Or should I look at another option? I thought Java might be the best option, seeing how easy it is to implement into HTML. Any help would be greatly appreciated.
It is easy enough to have a sequence of numbers, but there is no such thing as the number 001. There is only the number 1. It is possible to create a String “001” from it, but that is something different.
With java you would need some kind of external storage, a db, a textfile or something
It's good to be able to use someting, it's better to understand how it works.
Tim Moores wrote:
That seems to conflict with this requirement:
It also has to work across many workstations and users.
I'm taking it that you're thinking many "servers", but I believe that "workstations" means clients. As long as there's only one webserver, keeping a value in an Application Scope object for a JEE webapp is perfectly fine. At least until the system is restarted. At which point it's best if that value was also kept reliably updated in a nonvolatile storage such as a database.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
I am totally new to Java as well, and totally new to this forum.
But if I can offer a naive guess?
Java is a program/object based creating code, and can only run in a dedicated environment. It has a lot of limitations these days when it comes to running that code inside browsers/HTML. Many browsers no longer support Java applets running in them which is the environment required to express Java programs. So I think you may have to create this logging/counting program to reside on a server and have it referenced by the client side computer/workstation browsers.
I am not very experienced and so I am really really sorry if this information is ignorant. It just seems that you might be very limited in terms of the implementation of a program written in Java in terms of where it ultimately resides and runs and how it is invoked.