How to render .jsp from database without .jsp physical file - java

I am developing an application where I will have only loader.jsp which will load all other jsp files from the database. Like I am having all the coding for jsp file in database so that i can able to change the html content without restart the server in database itself.
Is there any framework already existing to implement this and what is the best way to achieve this?
If yes for render .jsp file dynamically, how to render css and js dependency also dynamically?
So my exact requirement is, I will have only loader.jsp which will load all other pages stored in database based on the path param.
http://localhost:8081/myApplication?page=mypage
TECHNOLOGIES USING: java spring boot
NOTE 1: I am not gonna render based of conditions or some parts of the file, I need to render entire page as it is from the database columns.
NOTE 2: if loading .jsp is not possible since jsp code need to be compiled, then can i load .html file? ex: loader.jsp will load a.html, b.html, c.html from database
NOTE 3: Am building application where user can able to drag and drop UI elements to create webpages and once if they save, their changes need to reflect on run time without restart. like they have one page in their own application itself to change their UI elements.

Related

Spring MVC #RequestMapping opening a different jsp

I have a SpringMVC application, and I need it to open a completely different jsp. If I am validating a transaction (in "editing.jsp"), and the data passes all editing steps, and it gets written successfully to the database, I need to redirect to display "success.jsp". Both jsp files exist in the WEB-INF/jsp directory. Ideally I'd like to also return some data to display in that page. This seems like it should be simple to do, but so far, I have not been able to discover how to change my #RequestMapping method do do it.
Perhaps I need to somewhere set up a mapping between "success.jsp" and a new different url?
Thanks in advance.

Saving a information displayed as different tab in browser to .html file

I am working on a project which is developed with Java Struts 2 framework. I am completely new to this. In project, when user clicks on a report button, a report is shown in different tab (the url of it looks like https://localhost:8181/myApplication/businessReport.do).
Goal: What I want is saving this report as html file in backend somehow. It is perfectly OK when user sees the report as he is seeing currently. It just needs to be saved in backend somewhere. The reason to do this is, te application is going to shutdown soon and our client wants to save those reports somewhere for future reference.
I could find businessReportForm.java, businessReportAction.java and also businessReport.jsp files in my project. I assume they should be of my interest.
Note: It uses mapping.findForward from Action mapping
I do not understand following and it would be nice if someone can help with that.
What could be the last point in (with respect to strut framework) where all the information for report would be ready ? (I would lke to use it to create .html file out of it)
What I need to change here in order to achieve the goal ? changing .jsp , changing Action or should change be done in corresponding Action class ?
in the url what does businessProcess.do actually mean with respect to jsp and servlet ?
any other idea what should be the approach to do what I want to do ? (saving report as html in background)

Spring MVC Carousel

How to make images slider (carousel) in Java Spring MVC.
I have admin panel which upload the images to local drive.
I would like to display images from local drive to JSP page in carousel.
Please guide.
Also I tried one example from the link https://blog.e-zest.com/dynamic-carousel-built-using-javascript/ but I am getting javascript error.
Thanks,
Bhavin
First you need to be able to serve your files to web browser. You can serve files from local drive using tomcat or web server (nginx, Apache httpd etc) built-in features without writing Java code or write a Spring controller to read files form drive and serve them if you need custom logic.
Then you could use one of javascript carousel plugins like Slick or another - there is a great choice of those.
Add needed scripts and css to your page and follow selected plugin instructions to create needed HTML with your JSP page.

Change html/jsp contents dynamically without restart the server

Am developing a application in which html content of the pages are able to change dynamically. From my application itself user can able to change their html pages using drag and drop form(which is used to design pages).
Once the page is edited and saved successfully, I need to restart the server to reflect the changes in browser which is hurting lot.
I want to build this solution without restart the server.
What I found:
Number 1: I try to have my html pages in DB or file and in run time, i will read from that and render in browser.
Problems:
1: performance
2: HTML code is working fine in out.print() But JSP code are showing as code itself in browser.
Is there any other solution available for to fix this or any existing framework available?

Can a JSF page be created dynamically?

I am trying to display the fields on a jsf page dynamically on load by taking the page source from the database.
Based on some query the page source will be taken from the database and be put onto the screen and the components should be displayed on the screen dynamically.
So there will be a single screen but the screen source data will be coming from the database and the all the components on the screen will be displayed on the screen dynamically.
How can this be done?
To be honest, doing it in JSF or JSP is unlikely to be very easy/ or performant.
You may as well skip the hassle, and just write some simple Java classes to bind inputs & render HTML output yourself.
I've done a lot of 'advanced UI' work with big/ tree-structured/ configurable UI in different projects. Mostly with JSP, JSTL and Spring -- but the performance problems will be the same.
Another area you'll have to address, is loading all the components quickly. Typically we've use 'bulk loading' queries in Hibernate to load all children/ subtrees in a single query. This has been very effective.

Categories

Resources