Springboot-shiro chapter02 & mdash; springboot webmvc jsp, springbootshiro

Source: Internet
Author: User

Springboot-shiro chapter02 -- springboot webmvc jsp, springbootshiro

Introduction: This section mainly involves spring boot's support for jsp. Due to its infamiliarity with spring boot, it takes some detours.

Environment:
IDEA15 +
JDK1.8 +
Maven3 +

 

I. pom. xml resource dependency

Compared with chapter01, there are more dependent resources. Spring-webmvc, spring-boot-starter, and spring-boot-tomcat are not directly referenced in chapter01. Instead, spring-boot-starter-web resources are referenced.

We can see that spring-boot-starter-web contains resources of chapter01. to parse jsp resources, we need to introduce jsaper, compile the jsp file into a java file, and compile it into a class file. In this case, jvm can load the corresponding class file of jsp.

In addition, jstl (jsp standard tag library) resources are mainly JSP standard tag libraries, improving jsp development efficiency

Note: The <parent> node is used to indirectly depend on spring-boot-starter-parent. Otherwise, compilation exceptions may occur during compilation.

Ii. springboot Configuration

Set attributes related to the spring MVC view parser.

spring.mvc.view.prefix: /WEB-INF/jsp/spring.mvc.view.suffix: .jsp

Startclass differs from chapter01. SpringBootServletInitializer inherits this class to deploy the application to the servlet container.

@SpringBootApplication@ComponentScan(value="com.shujushow")public class Chapter02Application extends SpringBootServletInitializer {    @Override    protected SpringApplicationBuilder configure(SpringApplicationBuilder application){        return application.sources(Chapter02Application.class);    }    public static void main(String[] args) throws Exception{        SpringApplication.run(Chapter02Application.class, args);    }}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.