intellij idea 使用struts2访问action时出现404错误
来源:互联网 发布:淘宝店铺可以不装修吗 编辑:程序博客网 时间:2024/05/23 00:05
错误如图,
struts.xml配置没错:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <!-- 指定Struts 2配置文件的根元素 --><struts><!-- 指定全局国际化资源文件 --><constant name="struts.custom.i18n.resources" value="mess"/><!-- 指定国际化编码所使用的字符集 --><constant name="struts.i18n.encoding" value="GBK"/><!--指定constant的name为devMode表示处于开发模式,value=true修改配置文件内容自动热替换而不需要每次重新发布--><constant name="struts.devMode" value="true"/><!-- 所有的Action定义都应该放在package下,Struts2中通过package来管理action,这里的包名name并不对应java类中的包 --><package name="hello" extends="struts-default" > <action name="HelloWordAction" class="Action.hello.HelloWordAction" > <!-- 定义三个逻辑视图和物理资源之间的映射 --> <result name="input">/login.jsp</result> <result name="error">/error.jsp</result> <result name="success">/success.jsp</result> </action></package></struts>后来发现是web.xml的配置有错,过滤器把action拦截了,在filter标签中添加<url-pattern>*.action</url-pattern>后问题解决。
web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping></web-app>
阅读全文
0 0
- intellij idea 使用struts2访问action时出现404错误
- struts2.5.10 出现action 404错误
- 使用IntelliJ IDEA调试java script脚本出现错误提示
- intellij idea使用junit时出现的问题以及解决办法
- IntelliJ IDEA in Action
- IntelliJ IDEA Action System
- 使用intellij idea 创建tomcat项目的时候会出现该错误:
- IntelliJ IDEA 中 MySQL 出现 [42000][1064] 错误的解决办法
- intellij IDEA运行web程序出现错误Error listenerStart
- struts2.1.8.1升级到struts2.3.15.1出现action 404错误
- 使用Struts2自带的验证出现的页面错误问题:No result defined for action action.UserAction and result
- Intellij IDEA 编译错误
- IntelliJ IDEA 1099错误
- 使用Struts2时出现There is no Action mapped for namespace / and action name .
- Struts2当调用action时出现HTTP Status 404 问题解决
- IDEA配置Struts2出现There is no Action mapped for namespace [/] and action name [login]
- IntelliJ IDEA 10.0 使用javac 编译程序出现“非法字符
- JavaWeb 使用Intellij IDEA部署Web项目出现JmxAdminException
- Linux(CentOS7)安装zip、unzip命令
- HDU.2640 Queuing (矩阵快速幂)
- opencv(20)---轮廓查找与绘制
- shell命令学习笔记
- 1030. 完美数列(25)
- intellij idea 使用struts2访问action时出现404错误
- NFC的android实现
- c++实现“反应时间”测试
- NFC在Android平台的架构与移植
- NYoj 74 小学生算术
- 非阻塞和协程
- javaWeb 手动建目录树创建web应用并部署
- [时间序列分析][6]--季节差分
- 配置grunt进行css、js的检查、合并和压缩