title: How to connect frontend and backend correctly?
body: <p>I'm new in the web programming. So, i have some trouble with understanding how to connect front and back ends. I'm writing on java. So, I have spring mvc and jsp(or another template engine like Apache FreeMarker etc.) as view layer. How to integrate there reactjs or angular2+ fron-tend frameworks? And should I do that stuff?
  Is it actual to use java code in html (jsp) or ruby code in html (erb)? If it is actually, how to use front-end frameworks in this case?(Or it shouldn't be used?)
  May be I must create something like RESTful back-end and integrate it with angular 2(as an example)? 
  May be there is other way to integrate them? Could You explain me how should i create my web app? Or share with me some links by this topic? 
  If there are several way to do what i ask, could you, also,  explain me advantages and disadvantages of each approach? And sorry for my English. Thank you in advance.</p>