Re: Java Servlet, Apache Tomcat, and MySQL

Hi, I use the Java stack with MySQL and React/Angular a lot for work.
In terms of the technology you will probably want, it will be Spring Boot. Spring boot is mainly meant for creating RESTFul APIs. So if you are looking for something that will handle a view as well, you will have to use an older technology. Spring Boot is the modern way of creating Java backends, although there is also Spring MVC, which uses the MVC pattern to push java server pages (jsp), which is an html like sintax, to the browser. I don't recommend this though if you are starting a new project.

The modern web stack is something like I mentioned above, creating a Spring Boot REST API hitting the database of your choice, then using a single page application (SPA) technology like React.js or Angular to manage your front end. You mentioned you are using JDBC, that works, although personally I like using object relational mappers (ORM), specifically spring data JPA/Hibernate. If you are not familiar with ORMs, the idea is that you map every table in your database to a java class that is anotated with the JPA annotations. This simplifys accessing your database significantly.

Also, I will advise using the design architecture of splitting your application up into a few different packages. You will have a folder for controllers, services, Ddao/repositories, and entities. Each of these layers perform a specific task, where the controller layer manages the entry points into your API, mapping all of your endpoints to methods. The service layer is called on from the controller layer, managing all of the business logic, such as validation or any other hard logic. The service layer will then call a database access object (dao) to hit the database. The DAO layer is where your JDBC code belongs, and this is the layer that is simplified down to just a couple lines of code if you use an ORM. The Entities are used by the database access objects, and if you are using an ORM, you would mark up your entities with JPA annotations.

You mentioned sessions, is that for security? When using these modern technologies, we tend to use JSON Web Token (JWT) for authentication. Most of the time you will just store what you need in the browser, but Spring boot does support different types of beans such as session beans for special cases.

Hope this was helpful,

Timothy Breitenfeldt

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : leibylucw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : leibylucw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector

Reply via email to