0

I am trying to build a simple click based game using Java EE. So LOTS/All of functionality is triggered by clicking buttons. Am I correct in assuming I can build this thing easily with only using servlets and jsps? So no javascript. Will Java EE give me all the same functionality that javascript could if I wanted to make a decoupled web app instead of my app being rendered totally from the backend?

Also I'm new to Java EE and want to make sure I'm approaching my problem correctly.

I've been trying to display a background image specific to each location in the game that renders when the user changes the location but this seems difficult to find out how to do.

Proctor
  • 21
  • 6
  • 2
    Yes. You can. **But**, without JavaScript every action will require a full screen redraw and page load; it might look usable locally. It will not be "usable" in any modern sense. – Elliott Frisch May 29 '19 at 23:19
  • *"Will Java EE give me all the same functionality that javascript"* No! You need JavaScript to detect the user clicking on anything other than a submit button. Unless your "simple click based game" consists of nothing but submit buttons, you'll need *some* JavaScript. – Andreas May 29 '19 at 23:29
  • Thank you. I'm now wondering how I'd use javascript to communication with the Java backend if this isn't a normal CRUD app. Say if I had a java class that had an int variable that I wanted to increase by a button click on the front end, how would I do that? Would I hit the backend with a update request to add one to the existing int value? – Proctor May 29 '19 at 23:49
  • ""Will Java EE give me all the same functionality that javascript could" Absolutely no. To answer your question, what you would do is use ajax. You make an ajax call to the servlet, the servlet then gets the value from the class and returns it. Check out this link about it: [link](https://stackoverflow.com/questions/4112686/how-to-use-servlets-and-ajax) – Jonathan Laliberte May 30 '19 at 13:58

0 Answers0