社区
Java
帖子详情
tomcat启动后只能访问web根目录下面的页面
Ronan_D
2017-11-23 07:39:12
根目录下的main.jsp能访问
views目录下访问报404
这是什么问题啊,大佬们帮帮忙
...全文
476
3
打赏
收藏
tomcat启动后只能访问web根目录下面的页面
根目录下的main.jsp能访问 views目录下访问报404 这是什么问题啊,大佬们帮帮忙
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
自由自在_Yu
2017-11-23
打赏
举报
回复
http://blog.csdn.net/cai_eternal/article/details/53344183
Ronan_D
2017-11-23
打赏
举报
回复
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <!-- 不加此注解 会报No mapping found for HTTP request with URI --> <mvc:default-servlet-handler/> <!-- 设置DispatcherServlet上下文,自动扫描有@Controller注解的所有类 --> <context:component-scan base-package="com.ssmtest.controller" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!-- 开启表示层注解 --> <mvc:annotation-driven> <mvc:message-converters> <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>application/json;charset=UTF-8</value> <value>text/html;charset=UTF-8</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <!-- 使用映射方式处理静态资源 --> <mvc:resources mapping="/adminPersonalFile/**" location="/adminPersonalFile/"/> <mvc:resources mapping="/assets/**" location="/assets/"/> <mvc:resources mapping="/policePersonalFile/**" location="/policePersonalFile/"/> <mvc:resources mapping="/images/**" location="/images/"/> <!-- 配置视图解析器 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <!-- 配置文件上传 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="20971520"/> <property name="defaultEncoding" value="UTF-8"/> <property name="resolveLazily" value="true"/> </bean> </beans>
Ronan_D
2017-11-23
打赏
举报
回复
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>Demo</display-name> <welcome-file-list> <welcome-file>welcome.jsp</welcome-file> </welcome-file-list> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</param-value> </context-param> <!-- 配置Spring的监听器 : spring主容器--> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param> <!-- spring mvc子容器 --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-servlet.xml</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- spring 过滤器--> <filter> <filter-name>charset</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> </filter> <filter-mapping> <filter-name>charset</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>
Tomcat
6.0.37免安装版(64位)
Tomcat
6.0.37免安装版(64位系统),供亲们下载~
apache-
tomcat
-7.0.42-windows-x86(32位免安装包)
apache-
tomcat
-7.0.42-windows-x86(32位免安装包)
修改
Tomcat
默认
访问
根目录
Tomcat
安装后,
Tomcat
的主目录是
web
apps/root目录。 在conf文件夹
下面
找到server.xml 配置文件打开 在<hosts> ......</hosts>中间添加一行 <Context path="" docBase="/usr/
tomcat
/apache-
tomcat
-8.5.11/
web
apps/guanwang" debug="...
Java
Web
项目使用
tomcat
正常
启动
后,
访问
目录报404错误
今天遇到一个问题:在
Tomcat
正常
启动
,
访问
页面
均报404异常。 由于是借鉴别人的项目新建的Java
Web
项目,一直以为项目
启动
后的
访问
路径是在pom.xml或者在
web
.xml中设置的,其实是本末倒置了。 在eclipse中用maven新建项目时,即在项目配置中确定了文件
访问
的根路径为项目名称, 打开Navigator视图:window>>Show View,选择Navigator 在Navigator视图下,打开项目下的.settings目录下的org.eclipse.wst.c
Tomcat
启动
成功能
访问
主
页面
但是不能
访问
应用解决办法
还是之前做的登录系统,现在要部署到服务器上。 问题:在我本地能
访问
,在服务器上
Tomcat
主
页面
能
访问
,
访问
应用报404。 首先将
Tomcat
拷贝到服务器的某个目录,解压得到文件夹 然后将应用打成war包,直接扔到wabapps目录下。
启动
Tomcat
,成功 能
访问
主页 但是就是不能
访问
项目,
访问
报404 找了很久没有找到解决办法,之前也在网上收到过一篇类似的博客,是说过滤器的问题,...
Java
51,402
社区成员
85,918
社区内容
发帖
与我相关
我的任务
Java
Java相关技术讨论
复制链接
扫一扫
分享
社区描述
Java相关技术讨论
java
spring boot
spring cloud
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章