永发信息网

关于struts配置中 action 标签

答案:2  悬赏:40  手机版
解决时间 2021-04-12 22:17
  • 提问者网友:十年饮冰
  • 2021-04-12 15:31

一般情况下,在struts-config.xml里面的action配置如下:

<action
path = "/test"
name = "testForm"
type = "package.TestAction"
scope= "request"
parameter="method"
validate="true">
<forward name="success" path="/success.jsp"/>
...
</action>

type指的是这个action对应的类,用来处理请求

如下,如果没有配type,他默认会用哪个类来处理呢?

<action
path = "/test"
name = "testForm"
<!-- type = "package.TestAction" -->
scope= "request"
parameter="method"
validate="true">
<forward name="success" path="/success.jsp"/>
...
</action>

最佳答案
  • 五星知识达人网友:荒野風
  • 2021-04-12 16:52

不配置会错误的。


若想不配置的话,需要再struts的配置文件中配置监听器,会自动查找struts与spring中相同name所对应的路径


这需要spring的支持,应为sprint的配置文件中<bean>中配置了class来对应action类的位置。其路径与type相同。

全部回答
  • 1楼网友:酒醒三更
  • 2021-04-12 17:39
找不到了就
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯