Home>Article>Web Front-end> How to embed vue project into jsp page? (Method introduction)
How to embed vue project into jsp page? The following article will introduce to you the method of embedding jsp pages in vue projects. The article introduces it in detail through sample code. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Embed the jsp page in the vue project
One of the functional modules in a project today is another system Using the page that has been developed by jsp, I thought about embedding it directly into the current vue project to save development costs; but I found that it was not as simple as imagined
Create a server.vue component to load the jsp page
1. The first type (using v-html for jsp rendering)
server.vue
The jsp data format returned by the request
The content of index.jsp returned by the background is as follows:
Docker容器服务器管理
The page is displayed as follows:
Because: the jsp page only writes a few tags, and other data is dynamically rendered through methods in external js. However, using v-html only loads the jsp page to the current page, but does not load the js again; so There are only a few useless tags on the page! It was finally confirmed that this method is not feasible
2. The second method (using iframe for jsp embedding)
Modified server.vue
This time, I finally got the running effect as follows:
I still succeeded with the old-fashioned method. The test proved that this method is feasible and perfectly solved the problem. Hehe.
This article is reproduced from: https://blog.csdn.net/qq_34817440/article/details/99764511
For more related knowledge, please visitPHP Chinese website! !
The above is the detailed content of How to embed vue project into jsp page? (Method introduction). For more information, please follow other related articles on the PHP Chinese website!