Quote:
Originally Posted by slenderhusband
... but I'm having trouble understanding how can I "glue" everything together in a full-stack app.
...
So what I'm asking is, how can I call the message() Java method from Vue and bind the return value of it to the message property so it could be displayed in the Vue app? Similarly, how would I go about calling the counter() Java method when clicking some button in Vue and then displaying the result back?
I think there's a slight gap in understanding here. When you make a full-stack app, you are using distributed computing. Your front end (vue) and back end (java) are running in separate machines in most cases and are de-coupled so they don't have access to each other's methods directly. What you do instead is pass messages between them through API calls, usually http REST calls.
So what you need to do is expose your java methods in a restful API, then have your front end send http requests to it and get responses. To send http requests in javascript you use Ajax.
I think you should start with learning how to make your java program listen and respond to api requests, run it on your machine and use a tool like curl or postman to manually send requests to it and see the response (don't worry, it's not that complex).
When you have that figured out, then add the necessary code to your vue to send the same type of request via ajax and voila, you're done.
The next step would be to set up a DB that the java program would connect to and persist the data from the requests in. And then you could try setting up servers for the back-end and db in a cloud provider, hook them up so they can communicate and run your vue on a web server in the cloud to get a step closer to the real-life scenario.
Here's a couple of howtos:
https://medium.com/bb-tutorials-and-...d-4e9d72bb8ce5
https://developer.okta.com/blog/2018...spring-and-vue
Btw, if you're not dead set on Java, might I suggest giving Golang a try. It's c-like and procedural so transitioning from java is a breeze. It's much more straight forward to set up a simple restful API and get it up and running. It compiles to a simple binary that you just execute. No need for all those extra frameworks like Springboot or Maven etc.
Hope this helps.
Last edited by Wolfram; 10-17-2020 at 09:22 PM.