Action中的默认值

 如果没有指定Action.默认是ActionSupport

 如果没有指定的method。默认的是action中的execute()方法。

如果没有指定的result 的name属性。默认的是success.

 

<action name="test">
            
<result>/page/hello.jsp</result>
        
</action>


 Action视图转发方式

 1、从定向到特定的视图---redirect

通过result的type属性设置:

 

<?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="papaya" namespace="/test" extends="struts-default">
        
<action name="hello" class="com.papaya.action.HelloAction" method="execute">
            
<result name="success" type="redirect">/page/hello.jsp?userName=${userName}</result>
        
</action>
    
</package>
</struts>

相关文章:

  • 2021-12-14
  • 2021-11-15
  • 2022-01-06
  • 2021-11-30
  • 2022-02-14
  • 2021-05-15
  • 2021-07-14
  • 2021-05-16
猜你喜欢
  • 2021-08-06
  • 2021-12-02
  • 2021-10-11
  • 2021-06-24
  • 2021-11-09
  • 2022-12-23
相关资源
相似解决方案