L
L
LucemFerre2014-04-07 20:12:22
Java
LucemFerre, 2014-04-07 20:12:22

Spring MVC, frontend+backend templating. What solution would you recommend?

I want to make the return of the first page on the site in the usual html, all further actions, with the support of the client, pull json. On a good note, I would like to leave most of the links working without js, so that everything would be generated on the backend.
Now the option is to do everything through mustache, since there is a template engine for java. Of the minuses, there is a lot of manual work, the need to duplicate control methods for returning json and html (or abandoning the standard spring routing, some kind of customization, a separate filter).
The solution seems to be quite standard, but so far there are no more ideas. I have no particular attachment to technologies, the project is at the design stage. The only thing, I would not want to deploy some JBOSS for this... )))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Lopatin, 2014-04-08
@LucemFerre

This is possible with JSF.
When a page is rendered for the first time, it is rendered entirely on the server. After that, you can already redraw only parts of the page. For example, leave the navigation in place and redraw only the main content of the page.
Here is an extremely simple example to understand how it works.

R
Ruslan Lopatin, 2014-04-07
@lorus

For a single-page application, it seems to me that a template engine is not needed at all. You can always return the same (empty) HTML document, and JavaScript, depending on the URL of the page, will already add everything that is needed to it.
Otherwise, duplication of code on the client and on the server cannot be avoided.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question