I am new to writing sites. Wrote the front in HTML, CSS, JS. In terms of back-end, I would like to use the Spring framework, since I am familiar with Java. I plan to send data from the controller to JSON and disassemble it at the front via JS. The questions are as follows:

  1. Did I choose the right technology (Spring and JSON)?
  2. Do I have any alternative options besides using JSP?
  3. Would it be more appropriate to use Spring MVC and send data through the Model? (This option is not much like, because the code is spoiled with jsp tags).
  4. In case of using the variant with JSON, is it correct to use AJAX?
  5. Does it make sense to generate JSP pages when using JSON? In this case, in fact, HTML remains unchanged.

Thank you in advance for the answers.

Closed due to the fact that it is necessary to reformulate the question so that you can give an objectively correct answer to the participants D-side , aleksandr barakin , insolor , MihailPw , rjhdby Jun 17 '17 at 9:44

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    2 answers 2

    1) If the site is already written, then it is better to use spring boot. So it will be much easier to integrate the front, through Ajax requests to send JSON objects to the back. Spring boot by default already has a configuration for deserializing JSON into Java objects.

    2) JSP is one of the server page rendering options. In your case (written front), you can use client templating engines ( javascript/template , jQuery has something for this purpose).

    3) If you design a backend as a REST API, then you use HTTP to communicate with it.

    4) Yes.

    5) There is no meaning, the backend gives the data that needs to be displayed, and the front knows how to display this data.

    I recommend to look at start.spring.io to initialize the project.

      Did I choose the right technology (spring and json)?

      Will fit. Look at an example of a REST service .

      Do I have alternatives besides using jsp?

      You can replace jsp with different template engines like thymeleaf or freemarker .

      Would it be more appropriate to use spring mvc and send data through the model? (This option is not much like, because the code is spoiled with jsp tags). In case of using the option with json, is it correct to use ajax? Does it make sense to generate jsp pages when using json? In this case, in fact, html remains unchanged.

      Generating json using template engines (like jsp) is not a good idea. There are special libraries for mapping java-classes in json and back. Spring will do this automatically for controller class methods.

      • REST as far as I understand stateless. If users with different access rights are planned on the site, work with money, etc., is it necessary to use for this session? This moment confuses me. If sessions are not required, then only REST is actually - Nikita
      • @Nikita you are free to do as it will be convenient, REST is just an ideology of a certain web-API, how much it is * ful - it already depends on the task. Nothing prevents you from doing a regular site (with generating most of the content using the same jsp), the pages of which will make some ajax requests. - free_ze
      • Thank you very much - Nikita