java web程序部署到linux上面页面不显示

qq_33315169 2017-09-19 03:49:43
在本地跑的没有问题,在linux上面就不行,防火墙都关了,jdk也换了,tomcat也换了,都不行,求解
...全文
346 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
sjjk 2017-09-19
  • 打赏
  • 举报
回复
你肯定有一个类似/login 这样的正常进入login页面的action吧,而且我觉得这里应该是重定向到login页面的,response.sendRedirect("/login"),像这样, 而且,就算你要转发,那也应该是类似request.getRequestDispatcher("/login").forward(request,response),而不是绕过视图解析器,直接访问jsp
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复
sjjk 2017-09-19
  • 打赏
  • 举报
回复
看看你重定向到login.jsp的那段代码是怎么写的
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复
<?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" xmlns:cache="http://www.springframework.org/schema/cache" 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 http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <!-- 启用spring mvc 注解--> <mvc:annotation-driven> <!-- 启动JSON格式的配置 --> <mvc:message-converters> <!-- 这里也可以自己定制class --> <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> <!-- 避免IE出现下载JSON文件的情况 --> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <!-- 对静态资源文件的访问 缓存一年 <mvc:resources mapping="/images/**" location="/WEB-INF/images/" cache-period="31536000"/> <mvc:resources mapping="/css/**" location="/WEB-INF/css/" /> <mvc:resources mapping="/js/**" location="/WEB-INF/js/" /> <mvc:resources mapping="/fonts/**" location="/WEB-INF/fonts/" /> <mvc:resources mapping="/favicon.ico" location="favicon.ico" /> --> <!-- 自动扫描的包名 ,使Spring支持自动检测组件,如注解的Controller--> <context:component-scan base-package="com.cn.controller.*" /> <context:component-scan base-package="com.cn.service.*"/> <!-- 视图解析器:定义跳转的文件的前后缀 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> <!--可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑 --> </bean> <!--<mvc:view-controller path="/" view-name="forward:/index.jsp"/> --> <!-- 缓存配置(两种) --> <!-- 启用缓存注解功能(请将其配置在Spring主配置文件中) --> <cache:annotation-driven cache-manager="cacheManager"/> <!-- 使用Spring自身提供的缓存器,则注释掉下面的两个关于Ehcache配置的bean,并启用上面的SimpleCacheManager即可 --> <!-- Spring提供的基于的Ehcache实现的缓存管理器 --> <bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation" value="classpath:ehcache.xml"/> </bean> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="cacheManagerFactory"/> </bean> <!--配置拦截器, 多个拦截器,顺序执行 --> <mvc:interceptors> <mvc:interceptor> <!-- /**的意思是所有文件夹及里面的子文件夹 /*是所有文件夹,不含子文件夹 /是web项目的根目录 exclude-mapping 不拦截的url --> <mvc:mapping path="/" /> <mvc:mapping path="/**" /> <mvc:exclude-mapping path="/HuaXiaNotify"/> <mvc:exclude-mapping path="/code"/> <mvc:exclude-mapping path="/logout"/> <!-- <mvc:exclude-mapping path="/weChatNotify"/> --> <bean class="com.cn.interceptor.CommonInterceptor"></bean> </mvc:interceptor> <!-- 当设置多个拦截器时,先按顺序调用preHandle方法,然后逆序调用每个拦截器的postHandle和afterCompletion方法 --> </mvc:interceptors> </beans>
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复
ssm框架,在我本地的myeclipse里面启动没问题啊
sjjk 2017-09-19
  • 打赏
  • 举报
回复
看日志,先是重定向到login.jsp,但是把这个静态资源当做一个action去处理了,没找到,然后重定向404.jsp,又当成了action处理,还没找到,就是你最终看到的情况。 你用的是什么框架?静态资源访问控制有没有做?
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复
tomcat能正常启动,项目在启动的时候也没有报错
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复
qq_33315169 2017-09-19
  • 打赏
  • 举报
回复

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧