There is a JSP-file with a description of HTML, it has js-scripts: ajax and all that.

What is better to leave them there or create a js-file for them and address it?

  • Naturally, it is better to separate HTML and JS whenever possible. - Nofate
  • I think so that there is not too much code on jsp but what about speed? Will it not be reflected? - elik
  • one
    How convenient - do it. If the code is not very much and / or no one else will write and read the code - everything is possible in one file. It is convenient to separate into different ones when the team writes, when there is a lot of code, so as not to be confused. - CodeGust
  • Clear dear friend thank you - elik

1 answer 1

Js is best kept separately (as pictures and styles). If the js volume is large (and there are many files), then it is better to minimize it and merge it into one js.

  • Understandably, in principle, I thought so. But I wanted to clarify all of a sudden it will have a negative impact on something - elik
  • @elik often front-end write in a language other than java. And accordingly I use completely different methods and tools. - Mikhail Vaysman