action管理方式

1struts.action.extension可以修改请求后缀
在struts.xml中使用
<constant name="struts.action.extension" value="do,action"/>
struts.xml中和struts.properties中可以配置常量,最好在struts.xml中定义
struts-default.xml
struts-plugin.xml
struts.xml
struts.properties
web.xml
重复定义常量,后面的常量值会覆盖前面的常量

2<constantname="struts.i18n.encoding" value="UTF-8"/>
参数作用于setCharacterEncoding方法 freemarker的输出

系统自动重新加载
<constantname = "struts.configuration.xmlreload"/>

创建spring负责创建actin对象
<constantname = "struts.objectFactory"/>
限制上传文件大小
<constantname = "struts.multipart.maxSize" value="10838274"/>
3处理流程 action的管理方式
用户请求--》strutsprepareAndExecuteFilter---》
inerceptor,struts2d内置的一些拦截器---》
用户编写action类---》result进行跳转---》jsp、html---》浏览器响应
包唯一的
4,指定多个struts文件
<struts>

<constant name="struts.action.extension" value="do,action"/>
    <include file="department.xml" />
    <include file="employee.xml" />
   
</struts>
employee.xml如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="employee" namespace="/control/employee" extends="struts-default">
        <action name="helloWord" class="cn.itcast.action.HelloWorldAction" method="execute" >
            <param name="savepath">/employee</param>
            <result name="success">/WEB-INF/page/message.jsp</result>
        </action>
            
    </package>
</struts>

posted on 2012-06-04 23:04 youngturk 阅读(196) 评论(0)  编辑  收藏 所属分类: struts2


只有注册用户登录后才能发表评论。


网站导航:
 
<2012年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

统计

公告

this year :
1 jQuery
2 freemarker
3 框架结构
4 口语英语

常用链接

留言簿(6)

随笔分类

随笔档案

文章分类

文章档案

相册

EJB学习

Flex学习

learn English

oracle

spring MVC web service

SQL

Struts

生活保健

解析文件

搜索

最新评论

阅读排行榜

评论排行榜