Struts2
23号员工
这个作者很懒,什么都没留下…
展开
-
There is no Action mapped for namespace [/] and action name [helloworld] associated with context pat
There is no Action mapped for namespace [/] and action name [helloworld] associated with context path [/struts2_day01].解决方案:struts.xml文件的位置放置问题struts.xml应该放置在src下,笔者误操作将其放在了Action的包下修改后及得重启一...原创 2019-03-01 18:45:39 · 520 阅读 · 0 评论 -
自定义Interceptor如何放行特定方法
1 继承MethodFilterInterceptorMethodFilterInterceptor里面有两个参数excludeMethods和includeMethodsexcludeMethods是用于要放行的方法includeMethods是用于要拦截的方法2 在struts.xml中配置...原创 2019-03-24 11:58:32 · 1441 阅读 · 0 评论 -
MethodFilterInterceptor和AbstractInterceptor的比较
在编写自定义拦截器的时候,需要继承AbstractInterceptor或者MethodFilterInterceptor,那么他们有什么不同呢首先查看MethodFilterInterceptor的源代码我们发现MethodFilterInterceptor也是继承了AbstractInterceptor的,并且MethodFilterInterceptor里面定义了两个参数,分别是excl...原创 2019-03-24 11:50:10 · 643 阅读 · 0 评论 -
Interceptor中如何使用addActionError 、addFieldError、addActionMessage
addActionError 、addFieldError、addActionMessage都是ActionSupport中提供的方法因此需要在Interceptor里面通过invocation获取ActionSupport(invocation.getAction---获取当前的action)protected String doIntercept(ActionInvocation i...原创 2019-03-24 11:25:36 · 238 阅读 · 0 评论 -
struts2中dtd约束所在的位置
原创 2019-03-23 21:05:02 · 299 阅读 · 0 评论 -
Struts2 复杂数据类型封装List/Map
要求将如下数据进行操作:方式一、将复杂数据类型封装到List中1 编写Action2 编写jsp页面方式二、将复杂数据类型封装到Map中1 编写Action2 jsp页面...原创 2019-03-06 19:34:41 · 126 阅读 · 0 评论 -
struts.xml 中如何配置input逻辑视图
原创 2019-03-06 18:38:22 · 218 阅读 · 0 评论 -
struts.xml 中如何配置全局result
在struts标签下的package下面写有一个<global-results></global-results>标签<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configur...原创 2019-03-03 16:14:13 · 267 阅读 · 0 评论 -
Struts2 访问Action的三种方法
1 修改method方法2 通配符的方式(常用)3 动态方法访问(默认关闭)因此首先要在配置文件中修改常量值以开启动态访问然后在配置文件编写action如下编写访问路径...原创 2019-03-02 15:58:12 · 351 阅读 · 0 评论 -
Struts2 Action类的三种写法
1 Action类是POJO的类(POJO-----简单java对象类) 建立Action类 2Action类去实现Action接口3 Action类去继承ActionSupport类写好Action类之后要写配置文件,并在struts.xml中引入配置文件编写配置文件...原创 2019-03-02 15:22:39 · 143 阅读 · 0 评论 -
Struts2 分模块开发的配置(web.xml引入其他配置文件)
原创 2019-03-02 14:32:01 · 157 阅读 · 0 评论 -
struts2 中 常量的配置
默认常量的配置在struts2-core下的default.properties中修改常量的值可以在以下三个位置进行修改struts.xml-----常用位置struts.properties(自行在src下新建----该文件只能实现修改常量功能)web.xml...原创 2019-03-02 14:20:06 · 138 阅读 · 0 评论 -
struts.xml 中 result中的属性的含义
原创 2019-03-01 20:38:17 · 247 阅读 · 0 评论 -
struts.xml 中 action中的属性的含义
原创 2019-03-01 20:30:34 · 340 阅读 · 0 评论 -
Struts.xml 中 package中的属性的含义
原创 2019-03-01 20:18:24 · 189 阅读 · 0 评论 -
Struts2 配置文件加载顺序
原创 2019-03-01 19:58:03 · 87 阅读 · 0 评论 -
Struts2 XML没提示的问题解决----引入本地DTD约束
Window->Preferences->XML Catalog点击Add本地dtd约束文件可以在Struts2-core-2.3.2.jar包中找到,将它复制出来到任意目录即可,最终在Location出链接到该路径即可...原创 2019-03-01 19:38:30 · 256 阅读 · 0 评论 -
Struts2执行流程图
原创 2019-03-01 19:27:45 · 129 阅读 · 0 评论 -
Struts2入门案例
1 新建web项目2 导入Struts2所需jar包3 在web.xml配置Struts2的核心过滤器4 编写Ation类5 编写Struts2的配置文件struts.xml6 建立jsp页面原创 2019-03-24 12:26:22 · 93 阅读 · 0 评论