How to map request parameter to a bean with different name in struts2

前端 未结 1 1116
花落未央
花落未央 2021-01-20 04:50

I know Struts 2 make automatic mapping from request parameter to action class fields using param interceptor. But what if I want to map a parameter to an action

相关标签:
1条回答
  • 2021-01-20 05:23

    Use the alias interceptor, nutshell:

    <action name="someAction" class="com.examples.SomeAction">
        <!-- The value for the foo parameter will be applied as if it were named bar -->
        <param name="aliases">#{ 'foo' : 'bar' }</param>
    
        <interceptor-ref name="alias"/>
        <interceptor-ref name="defaultStack"/>
        <result>result.jsp</result>
    </action>
    
    0 讨论(0)
提交回复
热议问题