Struts配置文件action中必须配置的属性?
解决方案 »
- Spring中为什么实体类不用注入?
- hibernate入门问题
- 能否在struts2中实现只针对某一特定异常的拦截?
- spring+ibatis事务问题
- 请问 Hibernate中 如果不用Spring来管理session 用怎么样处理延时加载时出现session is closed的异常
- spring框架中的aplicationcontext.xml配置文件,谁会写!(jdbc事务管理)**急盼**
- 有些编译后能用IE看运行,而用appletviewer看却会出错
- 1000分 寻找技术(Hibernate)交流!
- 求:《java开发指南-应用xml和jsp开发电子商务》一书的原码,不胜感激
- 一个文件读取并运算的问题
- java 首页地址路径问题
- 问大家一个页面传值给Action的问题~
name class method
type ---Action类的名称,必须是全路径其他的非必须。注:以上为struts1.*下的写法 2.0的就没做过,不晓得。
path="/loginAction" scope="request"
type="org.chen.struts.loginAction">
<forward name="scuess" path="/scuess.jsp" />
<forward name="error" path="/error.jsp" />
</action>
说明:
A)name:并不是Action本身的名字,而是与之关联的ActionForm的名称
B)path:非常重要的属性。ActionSerlvet将用户的请求转发与之同名的Action.同名的意思是将请求 的".do"后缀去掉。匹配Action的path属性值
C)struts-config.xml中只要遇到path属性都要加"/"表示相当于WebRoot根目录而言
D)type:Action的类名
E)forward:将Action的转发映射到实际的jsp页面,在实际编程时应该用逻辑名进行转发
1.<package name="crm" namespace="/login" extends="struts-default">
<action name="helloworld" class="com.wj.crm.HelloWorldAction" method="execute">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
name:action名称(唯一)
class:类路径(包名+类名 默认ActionSupport)
method:方法名 (execute默认方法名)
result: 返回视图 (默认success)2.<package name="crm" namespace="/login" extends="struts-default">
<action name="option_*" class="com.wj.crm.HelloWorldAction" method="{1}">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
请求路径:/login/option_hello.action(hello为action中的方法名.action可以省略(默认))struts1:
1.<action forward="/WEB-INF/page/hello.jsp" path="/hello">
2.<action attribute="usersForm" name="usersForm" parameter="op"
path="/users" scope="request"
type="org.springframework.web.struts.DelegatingActionProxy"
validate="false"> 如果是true forward必须配置一个name="input"的视图
<forward name="toLogin" path="/login.jsp" />
</action>