社区
Java
帖子详情
启服务后,jsp文件找不到,路径不对,写的测试页面能正常访问
baidu_32636153
2017-05-26 05:07:35
...全文
267
5
打赏
收藏
启服务后,jsp文件找不到,路径不对,写的测试页面能正常访问
[图片]
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
110成成
2017-05-26
打赏
举报
回复
引用 4 楼 baidu_32636153 的回复:
不能直接访问里面web-inf的页面,如果全部取出来那也不行,怎么才能直接方位web-inf下面的页面呢?
一般都是通过控制器跳转,放在web-inf下是为了安全。
baidu_32636153
2017-05-26
打赏
举报
回复
不能直接访问里面web-inf的页面,如果全部取出来那也不行,怎么才能直接方位web-inf下面的页面呢?
baidu_32636153
2017-05-26
打赏
举报
回复
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name></display-name> <filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter> <filter-name>securityFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetBeanName</param-name> <param-value>springSecurityFilterChain</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>securityFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/root-context.xml /WEB-INF/spring/security.xml /WEB-INF/spring/scheduler.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- <listener> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> </listener> --> <!-- <listener> <listener-class>com.extr.listener.BaseListener</listener-class> </listener> --> <servlet> <servlet-name>Kaptcha</servlet-name> <servlet-class>com.google.code.kaptcha.servlet.KaptchaServlet</servlet-class> <init-param> <description> Border around kaptcha. Legal values are yes or no. </description> <param-name>kaptcha.border</param-name> <param-value>no</param-value> </init-param> <init-param> <description>Color of the border. Legal values are r,g,b (and optional alpha) or white,black,blue. </description> <param-name>kaptcha.border.color</param-name> <param-value>209,209,209</param-value> </init-param> <init-param> <description>Thickness of the border around kaptcha. Legal values are > 0. </description> <param-name>kaptcha.border.thickness</param-name> <param-value>1</param-value> </init-param> <init-param> <description>Width in pixels of the kaptcha image. </description> <param-name>kaptcha.image.width</param-name> <param-value>96</param-value> </init-param> <init-param> <description>Height in pixels of the kaptcha image. </description> <param-name>kaptcha.image.height</param-name> <param-value>25</param-value> </init-param> <init-param> <description>The image producer. </description> <param-name>kaptcha.producer.impl</param-name> <param-value>com.google.code.kaptcha.impl.DefaultKaptcha </param-value> </init-param> <init-param> <description>The text producer. </description> <param-name>kaptcha.textproducer.impl</param-name> <param-value>com.google.code.kaptcha.text.impl.DefaultTextCreator</param-value> </init-param> <init-param> <description>The characters that will create the kaptcha. </description> <param-name>kaptcha.textproducer.char.string</param-name> <param-value>345689ABCEFGHJKLMNPQRSTUVWXY</param-value> </init-param> <init-param> <description>The number of characters to display. </description> <param-name>kaptcha.textproducer.char.length</param-name> <param-value>5</param-value> </init-param> <init-param> <description>A list of comma separated font names.</description> <param-name>kaptcha.textproducer.font.names</param-name> <param-value>Arial, Courier</param-value> </init-param> <init-param> <description>The size of the font to use. </description> <param-name>kaptcha.textproducer.font.size</param-name> <param-value>22</param-value> </init-param> <init-param> <description>The color to use for the font. Legal values are r,g,b. </description> <param-name>kaptcha.textproducer.font.color</param-name> <param-value>0,165,120</param-value> </init-param> <init-param> <description>The noise producer. </description> <param-name>kaptcha.noise.impl</param-name> <param-value>com.google.code.kaptcha.impl.NoNoise </param-value> </init-param> <init-param> <description>The noise color. Legal values are r,g,b. </description> <param-name>kaptcha.noise.color</param-name> <param-value>0,165,120</param-value> </init-param> <init-param> <description>The obscurificator implementation. </description> <param-name>kaptcha.obscurificator.impl</param-name> <param-value>com.google.code.kaptcha.impl.ShadowGimpy</param-value> </init-param> <init-param> <description>The background implementation. </description> <param-name>kaptcha.background.impl</param-name> <param-value>com.google.code.kaptcha.impl.DefaultBackground</param-value> </init-param> <init-param> <description>Start background color. Legal values are r,g,b. </description> <param-name>kaptcha.background.clear.from</param-name> <param-value>255,255,255</param-value> </init-param> <init-param> <description>Ending background color. Legal values are r,g,b. </description> <param-name>kaptcha.background.clear.to</param-name> <param-value>255,255,255</param-value> </init-param> <init-param> <description>The word renderer implementation. </description> <param-name>kaptcha.word.impl</param-name> <param-value>com.google.code.kaptcha.text.impl.DefaultWordRenderer</param-value> </init-param> <init-param> <description>The value for the kaptcha is generated and is put into the HttpSession. This is the key value for that item in the session. </description> <param-name>kaptcha.session.key</param-name> <param-value>KAPTCHA_SESSION_KEY</param-value> </init-param> <init-param> <description>The date the kaptcha is generated is put into the HttpSession. This is the key value for that item in the session. </description> <param-name>kaptcha.session.date</param-name> <param-value>KAPTCHA_SESSION_DATE</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>Kaptcha</servlet-name> <url-pattern>/Kaptcha.jpg</url-pattern> </servlet-mapping> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/appServlet/servlet-*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file></welcome-file> </welcome-file-list> <session-config> <session-timeout>120</session-timeout> </session-config> </web-app>
110成成
2017-05-26
打赏
举报
回复
这个问题,论坛好多人问过了 web-inf下不能直接访问,通过控制器访问 或者放到webroot下。
青春没有彩排丶
2017-05-26
打赏
举报
回复
看看你的web.xml的配置
maven构建springmvc项目之IDEA运行tomcat无法
访问
jsp
页面
项目场景: 题主以IDEA用maven构建springmvc项目 问题描述: 项目部署到tomcat,
服务
正常
启
动,接口返回字符数据正常,但是一直
访问
不到
jsp
页面
。 原因分析: 题主从以下几个原因进行了排查 1.spring-mvc.xml没有配置视图解析器。 2.webapp包放置错误,没有读取到
jsp
资源。 解决方案: 经过
测试
,第一个原因不成立,不配置视图解析器也可以正常
访问
(后续排查出bug之后的
测试
),不过得
写
全
路径
,也不能省略前后缀。 然后接着排查第二个原因,猜对了开头,没
JSP
——
jsp
页面
访问
资源
路径
问题
一、探讨资源
路径
问题 目录结构: 目标:在index.
jsp
中显示night_block.jpg
测试
1:相对于工程根
文件
夹的
路径
。URL正确,未知错误 结果:无法显示,HTTP 响应头显示url正确: Request URL:http://localhost:8088/JWebStudy
JSP
/WEB-INF/images/innerImages/night_
jsp
路径
问题,导致配置tomcat虚拟
路径
,仍然
访问
不到
图片
以前
写
的一篇是关于eclipse下配置tomcat虚拟
路径
,
访问
不到
图片 的问题。 今天这个比较不一样,就是在完全已经配置tomcat的service.xml中的虚拟
路径
的前提下,不管你上传图片到指定盘符下面,还是上传到tomcat默认
路径
下面,都发现
访问
不到
你上传的
文件
的问题。 比如你设置的是上传到默认
路径
下: String path = request.getServletContext()....
SpringBoot项目
访问
不到
resources目录下的
jsp
文件
如果不借助任何模板引擎的话,
JSP
页面
放在resources目录下(包括缺省的几个子目录)是
访问
不到
的! 1、可以在resources目录下新建一个 META-INF目录,然后把需要的
jsp
页面
放在这个目录下面,接着在application.properties配置
文件
中配置一下
访问
路径
,就可以
访问
到
jsp
文件
了: 2、或者在 resources目录同级别的目录下面创建 weba...
解决在Eclipse中
jsp
文件
中的action跳转到servlet的时候的
路径
出错
这是我在做电商平台的时候出现的问题:我用在Login.
jsp
进行
测试
的时候,出现servlet
文件
找
不到
了。 我的
文件
目录如下图: 正常运行的地址http://localhost:8080/ShuMaweb/
jsp
/login.
jsp
当我要运行
jsp
的登录功能要跳转到LoginServlet的时候,地址就变成了:http://localhost:8080/ShuMaw...
Java
51,412
社区成员
86,033
社区内容
发帖
与我相关
我的任务
Java
Java相关技术讨论
复制链接
扫一扫
分享
社区描述
Java相关技术讨论
java
spring boot
spring cloud
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章