How to render html page dynamically with all its includes from database - spring

we are developing application in spring boot where the html css and js are gonna render from database or some other storage location like cache.
Is there any framework already existing to implement this?
If yes for render .jsp file dynamically, how to render css and js dependency also dynamically?

This post shows how to implement a Thymeleaf view resolver that gets the templates from database. You can tweak it to your needs (jsp's or whatever)

Related

How to implement Vue.js applications with Spring MVC or other server-sided frameworks?

I've already read the official Vue.js documentation about building app. What I understood is, by using vue-cli, *.vue files are built (or compiled ?) into a javascript file which is injected in index.html file.
What if I don't have any index.html ? In my current application, html documents are built at runtime from jsp template files, how can I have Vue inject js and 'asset' built files into a chosen jsp template ?
Plus, node server should be used in development mod, is this mandatory ?
I would copy the generated javascript file and put it in the public/static folder. Then on the jsps that would use it, just add a script tag that would point to it and the empty div#app.

Access View inside WEB-INF using angular.js

I am new to AngularJS. In my project all views html are inside WEB-INF folder, I want to use AngularJS so I have written app.js and controller.js but view is not rendering.
How can I resolve this?
Don't put them in WEB-INF. By design, WEB-INF is inaccessible from the outside. You can put your templates anywhere you want, except WEB-INF.
Or, since you're apparently using Spring, configure it to serve those resources, instead of using the default servlet.

Spring MVC template engin vs plane html

I'm a little confused about template engines like thymeleaf or velocity.
My question is are there any profits from using template engine instead plain html + angular?
I'm asking because I'm developing application using
Spring boot 1.3.2
Angular 1.4.8
Thymeleaf
and I'm wondering if is a chance in Spring MVC application that I'll nead template engine instead make it all in plain hmtl + angular?
AngularJS is as client-side Javascript framework.
Thymeleaf is a server-side template engine capable of create HTML, CSS, Javascript and text.
You can use both to create your web app.
For instance you can send to your customers already processed pages by Thymeleaf with the client specific data. As the customer interacts with your page you can use AngularJS to bring data from your server via Ajax or to process his requests locally, so your server will not need to send the entire page to your customer as he interacts with your page, this will make your page faster.

spring view template skinning

How can I implement a css based template skin for spring MVC app. Also, is it possible to change the template path for spring MVC file at runtime to load completely different theme based on user selection or url called?
Take a look at Spring Themes. Also, there are other options:
You may change class of <body>, for example, and have different themes as it is done in Dojo.
You may load stylesheets as alternate and switch them with JS.

Pluggable pages in a Spring MVC application

I'm developing a Spring application which needs to support pluggable modules - add the JAR to the classpath and it will automatically find and load the module's Spring application context XML. This part is already working.
The problem right now is figuring out a way for the modules to provide custom JSP pages. Each module will require a configuration page, which contains form fields specific to that module.
How can I use Spring MVC to implement such pluggable pages? It should work something like so, that the module's JAR file contains the configuration page (as JSP) and its Spring MVC controller, which the surrounding application will then include into the rest of the application (maybe as a JSP fragment inside the application's page template).
If this cannot be done with Spring MVC and JSP, then what would be a good alternative?
Try adding a ResourceBundleViewResolver config to each pluggable module (not sure if having multiple resolvers will work or not, but it allows you to define views via the classpath, not specific locations. See http://static.springsource.org/spring/docs/current/reference/view.html.
If having multiple resolvers in your modules don't work, then try ResourceBundleViewResolver in the main app config, and then have all pluggable modules follow the same view location setup internally to the JARs.

Resources