-
Cats萌萌
核心配置:1234567891011@Beanpublic ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean servlet=new ServletRegistrationBean(); servlet.setServlet(new SSIServlet()); List<String> urlMpping=new ArrayList<>(1); urlMpping.add("*.shtml"); servlet.setUrlMappings(urlMpping); servlet.addInitParameter("outputEncoding", "UTF-8"); servlet.addInitParameter("inputEncoding", "UTF-8"); return servlet;}关键点1、shtml页面要放在webapp下2、打jar包时,spring-boot-maven-plugin 使用1.4.2.RELEASE版本3、打jar包时,页面要copy到META-INF/resources目录下
-
富国沪深
首先你需要确定,如果你确实是使用springboot内置的tomcat,你需要检查,你的项目是否依赖springboot的这个jar包,即spring-boot-starter-web,如果是以maven管理项目的化,你直接查一下组件ID是这个的有没有,没有的化,需要引用
-
幕布斯7119047
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.2</version><configuration><source>1.7</source><target>1.7</target><compilerArguments><endorseddirs>${endorsed.dir}</endorseddirs></compilerArguments></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1.1</version><configuration><failOnMissingWebXml>false</failOnMissingWebXml><webXml>src/main/webapp/WEB-INF/web.xml</webXml><warName>user</warName></configuration></plugin><plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>8.1.16.v20140903</version><configuration><webAppConfig><contextPath>/user</contextPath></webAppConfig><stopKey/><stopPort/></configuration></plugin><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><port>8087</port><path>/user</path><uriEncoding>UTF-8</uriEncoding><server>tomcat7</server></configuration></plugin></plugins></build>在pom中配这个 然后直接用 tomcat7:run-war 来启动服务