Spring Boot 访问JSP页面 跳转下载

POM文件中依赖都引进来了

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>compile</scope>
        <!--<version>8.5.16</version>-->
    </dependency>

    <!-- servlet 依赖的jar包start-->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
    </dependency>

    <!-- jsp 依赖的jar包start-->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.1</version>
    </dependency>

    <!-- jstl标签 依赖的jar包start-->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

但是访问JSP页面时还是下载页面是什么问题,网上的方法都试了,都不行,不知道哪里出问题了。

1个回答

分析问题:
1、pom文件引入进来了,并不代表你的jar就真的有了,你可以去本地仓库看下这个jar到底下载下来没有,完不完整。
2、有可能,但是我不确定,因为没去仔细看你的jar包,有可能是包冲突,tomcat里面应该是有servlet,jsp包的,你可以试下倒入了tomcat,pom里面不倒入servlet和jsp试下,因为本身tomcat就是servlet和jsp容器

chengzi_cm
chengzi_cm 相同的POM依赖,相同的代码,在STS中就可以访问jsp页面,在idea中就会下载,看了jar包,jar包也都下载下来了
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

spring boot中找不到jsp

查了一天了也没查到问题,我配置了mvc的前缀和后缀,可就是返回不了jsp,是打的war包有问题吗, 还是缺少什么web的包,它只会报Circular view path [/main]: would dispatch back to the current handler URL [/main] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.),实在是查不到怎么解决了,照着springboot的官方web例子改也不行,直接返回了字符串而不是jsp页面,真心求各位帮帮忙。 yml配置文件里的源码 ``` mvc: view: prefix: /WEB-INF/jsp/ suffix: .jsp ``` gradle的依赖包引入 ``` compile 'org.springframework.boot:spring-boot-starter-data-jpa' compile 'org.springframework.boot:spring-boot-starter-freemarker' compile 'org.springframework.boot:spring-boot-starter-groovy-templates' compile 'org.springframework.boot:spring-boot-starter-jdbc' compile 'com.h2database:h2:1.4.190' compile 'com.alibaba:fastjson:1.2.7' compile 'com.google.guava:guava:18.0' compile 'org.springframework.boot:spring-boot-starter-redis' compile 'org.springframework.boot:spring-boot-starter-web' // compile 'org.springframework.boot:spring-boot-starter-jetty' compile 'org.springframework.boot:spring-boot-starter-tomcat' compile 'org.apache.tomcat.embed:tomcat-embed-jasper' compile 'javax.servlet:jstl' compile 'org.apache.directory.studio:org.apache.commons.lang:2.6' compile 'commons-io:commons-io:2.4' compile 'mysql:mysql-connector-java' testCompile 'org.springframework.boot:spring-boot-starter-test' compile 'org.springframework.boot:spring-boot-starter-data-rest' compile 'org.springframework.boot:spring-boot-configuration-processor' compile 'com.googlecode.xmemcached:xmemcached:2.0.0' ``` controller ``` @RequestMapping("/main") public ModelAndView welcome1() { logger.error("111111111111111") return new ModelAndView("/main") } ``` 日志能打出来,但是这个main.jsp找不到 war包的目录结构 ![图片说明](https://img-ask.csdn.net/upload/201604/27/1461742939_597620.png) 又去查了一下,视频和例子都在说引入 compile 'org.springframework.boot:spring-boot-starter-tomcat' compile 'org.apache.tomcat.embed:tomcat-embed-jasper' 两个依赖后,注释为@Controller,直接return字符串类型的jsp名就可以 可就是还是不行,ViewResolver好像没有设置

spring boot跳转不了到视图,有人知道怎么解决吗

感觉配置没错的啊,方法能访问,但是跳转到不到视图,用的是thymeleaf模板 引入了依赖 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509869987_577136.jpg) Controller的方法如下 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509870039_918802.jpg) application.properties配置如下 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509870067_98437.jpg) 模板文件是有的 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509870085_34187.jpg) 启动spring boot访问方法控制台也有输出 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509870113_906974.jpg) 但是页面总是404 ![图片说明](https://img-ask.csdn.net/upload/201711/05/1509870125_75835.jpg) 搞了一天了,不知道什么地方有错,我看网上的人都是这样配置的啊

spring boot 访问HTML 总是有缓存,如何修改前端页面实时生效

**1.问题:** ## spring boot 访问templates下的HTML 总是有缓存,如何修改HTML,前端页面实时生效。现在是必须重启项目才可以解决这个缓存问题 **2.项目结构:** ![项目结构](https://img-ask.csdn.net/upload/201906/25/1561457831_217016.png) **3.场景** 当我访问Cotroller层,之后跳转到 index.html 的时候,我已经更改HTML页面中的内容,但是并在网页上并没有实时更新。必须重启项目才可以看到我最新更改的信息 **3.1场景图** ![图片说明](https://img-ask.csdn.net/upload/201906/25/1561458119_776578.png) 项目中的HTML ![图片说明](https://img-ask.csdn.net/upload/201906/25/1561458211_289391.png) **5.**自己百度了一下,说要设置 **thymeleaf 模板引擎的缓存为 false**,我已经配置了,还是不行。 如图: ![图片说明](https://img-ask.csdn.net/upload/201906/25/1561458413_742428.png) **6.请教各位,如何解决这个问题** 。。。

springboot访问jsp页面报错

springboot访问jsp页面一直报如下错误java.lang.ClassNotFoundException: javax.servlet.Servlet at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:411) ~[na:1.8.0_77] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77] at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:148) ~[spring-boot-devtools-2.0.5.RELEASE.jar:2.0.5.RELEASE] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77] at java.lang.Class.forName0(Native Method) ~[na:1.8.0_77] at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_77] at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadFromParent(TomcatEmbeddedWebappClassLoader.java:112) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.doLoadClass(TomcatEmbeddedWebappClassLoader.java:85) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:68) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE] at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:123) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:60) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_77] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[na:1.8.0_77] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.8.0_77] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[na:1.8.0_77] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_77] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_77] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_77] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[na:1.8.0_77] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:129) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:60) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:159) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:185) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:394) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) ~[tomcat-embed-jasper-8.5.34.jar:8.5.34] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:315) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) ~[tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar:8.5.34] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar:8.5.34] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar:8.5.34] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]

spring security 如何实现登陆后跳转至登录前页面

spring security4.x 如何实现登陆后跳转至登录前页面。 比如我访问http://xxxx:8080/ABC/user/getList.do 服务器发现用户没有登陆跳转到第三方服务器登陆, 登陆认证成功后不是到项目的主页面 还是到跳转至http://xxxx:8080/ABC/user/getList.do页面并请求数据

eclipse配置springboot能正常启动而且可以访问静态页面 为什么访问不了Controller?

```package com.huarui; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringbootApplication { public static void main(String[] args) { SpringApplication.run(SpringbootApplication.class, args); } } package com.huarui.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Controller public class UserController { @RequestMapping("/list") public String gg() { System.out.println("1"); return "list"; } } <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.huarui</groupId> <artifactId>springboot</artifactId> <version>0.0.1-SNAPSHOT</version> <name>springboot</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` `求大神解答。。。在线等 ``` ``` ```

spring boot重定向之后js找不到

我的控制器是这样写的![图片说明](https://img-ask.csdn.net/upload/201706/29/1498707257_792804.png) ,可是请求http://192.168.3.45:9090/webadmin/之后js请求的路径是这样的http://192.168.3.45:9090/assets/global/plugins/select2/js/select2.full.min.js 正确的路径是这样http://192.168.3.45:9090/**webadmin**/assets/global/plugins/select2/js/select2.full.min.js。。为什么少了个webadmin

springboot+shiro,直接访问前端页面,不报错直接出来一个白板

我springboot整合shiro,shiro的filter里面我把登陆页面的的权限放开,但是直接访问,不报错,访问后出现白板页面,我弄的swagger也一样,访问不报错,直接白板页面 访问效果 ![图片说明](https://img-ask.csdn.net/upload/201902/18/1550472244_891390.png) ![图片说明](https://img-ask.csdn.net/upload/201902/18/1550472251_919719.png) filter ![图片说明](https://img-ask.csdn.net/upload/201902/18/1550472850_835760.png) ![图片说明](https://img-ask.csdn.net/upload/201902/18/1550477864_907779.png) ![图片说明](https://img-ask.csdn.net/upload/201902/18/1550477872_623662.png)

springboot ajax成功后function中的url跳转

我在9090/login/login页面中使用ajax异步, 希望在返回的function中跳转到主页面9090/index 我写的是 $("#loginBut").click(function(){ $.ajax({ url:[[@{login}]], data:$("#loginForm").serialize(), type:"post", dataType:"json", success:function(obj){ if(obj.state==0){ location="[[@{/index}]]"; } $("#message").html(obj.message); } }); }); 但他实际路径是http://127.0.0.1:9090/Login/'/index' 而我期望的是http://127.0.0.1:9090/index 请问这种跳转怎么写

HttpSession 过期 JSP 页面自动跳转到首页

RT ! Spring Boot 在配置文件中配置了 session timeout。当HttpSession过期,前台JSP如何能够在无用户操作的前提下自动跳转到首页或登录页? 比如用JQuery或是用什么方法? 因为前台使用了Iframe,所以虽然后台的Spring Security可以识别Session状态,然后返回要登录的页面,但是会直接加载到Iframe中,所以...

问下springboot访问localhost 为什么 自动 跳到 index.html

问下 springboot 访问localhost 为什么 自动 跳到 index.html了 哪里配置的? 问下 springboot 访问localhost 为什么 自动 跳到 index.html了 哪里配置的?

求教 为啥我的springboot没办法跳转到页面上。。。idea建的springboot项目

![![![图片说明](https://img-ask.csdn.net/upload/201806/08/1528418846_258712.jpg)图片说明](https://img-ask.csdn.net/upload/201806/08/1528418841_633463.jpg)![图片说明](https://img-ask.csdn.net/upload/201806/08/1528418880_134559.jpg)

SpringMvc访问WEB-INF下的jsp问题

Spring MVC.. jsp页面在WEB-INF下,想实现页面互访,但是WEB-INF下不能直接访问,拦截器设置成这样然后在controller进行跳转springMVC下也配置了,但是还是会报404![![图片说明](https://img-ask.csdn.net/upload/201712/04/1512389280_114857.png)图片说明](https://img-ask.csdn.net/upload/201712/04/1512389271_120513.png)

SpringSecurity登录的时候一直重定向,回到登录页面

springsecurity3.2 <br/>说起来,我这个原本前台是ANGULARJS+HTML写的 <br/>但是公司单点登录必须要JSP页面,因为是老系统,html不支持 <br/>所以没办法,就写了个JSP来登录 <br/>然后我登录上去会报302,而且response里面带location:login.jsp <br/>我确认过用户名密码,没问题,而且我也重写了UserDetailsService <br/>但是根本没有到UserDetailServic这一步,应该是授权的时候就不通过 <br/>说实话,对springsecurity不太了解,下面是配置文件,麻烦大神指点! <br/><br/>config-file <br/> ``` <!-- 以下页面不被拦截 --> <http pattern="/login_sso.jsp" security="none"></http> <http pattern="/css/**" security="none"></http> <http pattern="/fonts/**" security="none"></http> <http pattern="/images/**" security="none"></http> <http pattern="/js/**" security="none"></http> <http pattern="/lib/**" security="none"></http> <http pattern="/plugins/**" security="none"></http> <http use-expressions="false"> <!-- 拦截规则 --> <intercept-url pattern="/**" access="ROLE_USER" /> <!-- 登录配置 1登陆页面 2登陆成功跳转页面 3登录失败跳转页面 4总是使用默认跳转页面--> <form-login login-page="/login_sso.jsp" default-target-url="/index.html" login-processing-url="/j_spring_security_check" authentication-failure-url="/login.html" always-use-default-target="true"/> <csrf disabled="true"/> <!-- 由于使用了框架页面,所以要进行以下配置 --> <headers> <frame-options policy="SAMEORIGIN"/> </headers> <!-- 登出配置 --> <logout logout-url="/logout" logout-success-url="/login_sso.jsp"/> </http> ``` <br/> login.jsp ``` <form id="loginForm" name="loginForm" action="/modify/j_spring_security_check" method="post" > <input type="text" id="username" name="name" /> <input type="password" id="password" name="password" /> <input value="登录" style="width:100%;" type="button" onclick="document:loginForm.submit()"> </form> ``` <br/><br/> response信息,这个是向login-processing-url发起请求后的返回信息,直接被重定向回login.jsp了,而且都没到UserDetailService <br/> ![图片说明](https://img-ask.csdn.net/upload/201903/05/1551788138_54021.png)

搭了一个springboot项目 用自带的启动器页面可以正常跳转,但放到tomcat下页面跳转就报错

我以为是jar包冲突,但后面还是不能正常跳转 ## maven依赖 ```xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.yyt</groupId> <artifactId>yyt_web</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>yyt_web</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.8.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <!--jpa--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!--web--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--mysql--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <!--<scope>provided</scope>--> </dependency> <!--德鲁伊数据连接池--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.5</version> </dependency> <!--tomcat--> <!--<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> &lt;!&ndash;<scope>provided</scope>&ndash;&gt; </dependency>--> <!--添加对jsp,tomcat的支持--> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency> <!--servlet的支持--> <!--<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <scope>runtime</scope> </dependency>--> <!--添加对jstl的支持--> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.15</version> </dependency> <!--fastjson--> <dependency> <groupId>com.ruijc</groupId> <artifactId>spring-boot-starter-fastjson</artifactId> <version>2.2.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` ## tomcat Lib包 ![图片说明](https://img-ask.csdn.net/upload/201711/19/1511081162_43553.png) ## 报错信息 ## 1 ``` javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/jsp/find_005fall_jsp, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349) ~[jasper.jar:8.0.20] at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) ~[servlet-api.jar:na] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.20] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.20] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.0.20] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.20] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.20] at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) ~[druid-1.0.15.jar:1.0.15] ``` ## 2 ``` Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/jsp/find_005fall_jsp, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature at org.apache.jsp.WEB_002dINF.jsp.find_005fall_jsp._jspInit(find_005fall_jsp.java:59) ~[na:na] at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49) ~[jasper.jar:8.0.20] at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:179) ~[jasper.jar:8.0.20] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368) ~[jasper.jar:8.0.20] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) ~[jasper.jar:8.0.20] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) ~[jasper.jar:8.0.20] ... 88 common frames omitted ``` ## 页面报错 ![图片说明](https://img-ask.csdn.net/upload/201711/19/1511081361_129468.png)

Spring Controller如何返回 指定静态页面的内容

比如 试图解析器设置了 .jsp后缀 在web-inf下 如果想controller控制返回某个路径下的 不一定是web-inf 不受解析器控制的 怎么弄?req.getRequestDispatcher().forward????? 但是controller的返回值怎么办 返回null的时候会发生什么 我这边好像是首页???

SpringBoot中RequestMapping只能用页面URL输入回车才能跳转进方法是什么原因

这个是我Controller的代码 ``` package com.example.demo.controller; import com.example.demo.service.impl.UserService; import com.example.demo.user.User; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import javax.annotation.Resource; import java.util.List; @Controller public class UserController { @Resource private UserService userService; @RequestMapping(value = "/search") public String search(Model model) { //查询数据库所有用户 List<User> userList = userService.findAll(); model.addAttribute("users", userList); return "userList"; } @RequestMapping(value = "/Index") public String Index(){ return "Index"; } @RequestMapping(value = "/AddAdmin") public String AddUser(@ModelAttribute(value = "/save") User user){ userService.save(user); return "success"; } @RequestMapping(value = "/save") public String adduser(){ return "AddAdmin"; } } ``` 这个是Index的页面 ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Index</title> </head> <body> <form name="demo" method="post"> <!--YOUR DATA AREA--> <input type="button" value="添加" onclick="addAction()"> <input type="button" value="删除" onclick="deleteAction()"> <input type="button" value="查询" onclick="searchAction()"> </form> <script type="text/javascript"> function addAction(){ document.demo.action="/save"; document.demo.submit(); } function deleteAction(){ document.demo.action="/404"; document.demo.submit(); } function searchAction(){ document.demo.action="/search"; document.demo.submit(); } </script> </body> </html> ``` 这是直接点击查询按钮跳转的结果 ![这是直接点击查询按钮跳转的结果](https://img-ask.csdn.net/upload/201902/11/1549861375_236595.png) 这是直接回车URL的结果 ![这是直接回车URL的结果](https://img-ask.csdn.net/upload/201902/11/1549861469_855121.png) 这是Index页面 ![这是Index页面](https://img-ask.csdn.net/upload/201902/11/1549861507_591441.png)

springboot 2.x.x整合jsp的时候,二级目录下jsp不能访问

这个是jsp目录 ![图片说明](https://img-ask.csdn.net/upload/201906/27/1561598332_605259.png) springboot配置文件 ![图片说明](https://img-ask.csdn.net/upload/201906/27/1561598344_328673.png) 访问代码controller ![图片说明](https://img-ask.csdn.net/upload/201906/27/1561598354_809656.png) 报错信息 ![图片说明](https://img-ask.csdn.net/upload/201906/27/1561598363_731837.png)

springboot里面发.ftl跟.jsp

如果想要在springboot返回到freemaker的页面只要配置pom文件, 然后将freemaker模版放在templates下,controller直接返回String类型就可以了, jsp也是这样只不过jsp的路径是web-inf下,那如果同时有ftl跟jsp前缀相同呢,会怎么样。

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问
相关内容推荐