Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What to do if you use jsp in SpringBoot

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use jsp in SpringBoot? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

The default recommended template for the SpringBoot framework is: Thymeleaf is similar to the Freemarker .html template

Thymeleaf freemarker template syntax index.html = = > Welcome: ${name} = > static cache page

Integration of SpringBoot and jsp

Introduce dependency jsp, jstl

Jstl

Jstl

1.2

Org.apache.tomcat.embed

Tomcat-embed-jasper

Configure the attempt to resolve prefixes and suffixes, spring.mvc.view.prefix, spring.mvc.view.suffix in the application.yml file

Spring:

Profiles:

# Activate test configuration

Active: dev

Mvc:

View:

# Configure prefix

Prefix: /

# Configure suffix

Suffix: .jsp

Test by jumping to create a new UserController file

@ Controller

@ RequestMapping ("user")

Public class UserController {

@ RequestMapping ("findAll")

Public String findAll () {

System.out.println ("findAll")

Return "index"

}

}

If the above operations are finished, jsp is still not supported (the new version does not seem to need to configure this) Edit Configuration-- > Working directory-- > $MODULE_DIR$

For example, you can use http://localhost:8989/zq/user/findAll access to print out findAll, and then jump to index.jsp.

After reading the above, have you mastered the method of how to use jsp in SpringBoot? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report