• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Create numbers in a sequential order  RSS feed

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 5413
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a web app can do this if it persists the number, and also considers concurrency.

Any of a number of languages could be used for this. Whether Java is the right choice depends on a lot of factors that we know nothing about.

I thought Java might be the best option, seeing how easy it is to implement into HTML.


I don't understand what you're trying to say here. What's the connection between Java and HTML?
 
Marshal
Posts: 64182
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:

I thought Java might be the best option, seeing how easy it is to implement into HTML.


I don't understand what you're trying to say here. What's the connection between Java and HTML?



I think the op confuses java with javaScript
 
Daniel Demesmaecker
Rancher
Posts: 1170
18
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In javaScript it would be actually easier to do. If all it has to do is keeping a counter you could save it to localStorage.
With java you would need some kind of external storage, a db, a textfile or something
 
Tim Moores
Saloon Keeper
Posts: 5413
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Demesmaecker wrote:If all it has to do is keeping a counter you could save it to localStorage.



That seems to conflict with this requirement:

It also has to work across many workstations and users.

 
Saloon Keeper
Posts: 20658
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 sure of the coding you would need to make the connection between client and server. To actually embed the code within browsers you might need a more compatible scripting language like Javascript? maybe that could accomplish the calculations you need on the fly with the updates and to run on multiple workstations.
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.

I hope this helps.

cliff
 
Tim Moores
Saloon Keeper
Posts: 5413
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:I'm taking it that you're thinking many "servers", but I believe that "workstations" means clients.


That's how I interpreted it as well. I replied to the mention of "localStorage", which is a JavaScript client-side concept and clearly will not do.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could get a spring boot app to do this up and running in minutes and you wouldn't need to install tomcat.

 
Bartender
Posts: 2232
94
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

meenal deshpande wrote:Hi everyone. I am new to Java and not even sure it can accomplish what I am trying to do. ...


Hi, I noticed that this exact question was posted on codeproject website. We have a rule against that BeForthrightWhenCrossPostingToOtherSites <-- It's a link.
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!