1

I have a struts 2 that has an action that has to drive to another called "buscarProposta" leading a parameter, but page is giving error.

The action must pass the parameter is name = "produtor" type = "redirectAction".

<action name="consultarProposta" class="consultaPropostaLiberacaoComissaoAction" 
                                method="consultarProposta">
        <result name="input">/WEB-INF/pages/consultaPropostaLiberacaoComissao.jsp</result>
        <result name="success">/WEB-INF/pages/listaProposta/listaProposta.jsp</result>
        <result name="produtor" type="redirectAction">
            <param name="actionName">/WEB-INF/pages/produtores/produtores.jsp</param>
            <param name="chaveNegocio">${chaveNegocio}</param>
        </result>
   </action>


    <action name="buscarProposta" class="buscarPropostaAction" method="buscarProposta">
        <result name="success">/WEB-INF/pages/produtores/produtores.jsp</result>
        <result name="input">/WEB-INF/pages/listaProposta/listaProposta.jsp</result>
    </action>
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • Use the different type of the result. Redirect type results use response to send redirect result code to the browser. If you didn't supply parameters in the url then it will be discarded. – Roman C Sep 24 '15 at 11:44

1 Answers1

1
    <result name="produtor" type="redirectAction">
        <param name="actionName">/WEB-INF/pages/produtores/produtores.jsp</param>
        <param name="chaveNegocio">${chaveNegocio}</param>
    </result>

You are redirecting to a JSP, while redirectAction, as the name suggests, is used to redirect to an action:

<result name="produtor" type="redirectAction">
    <param name="actionName">buscarProposta</param>
    <param name="chaveNegocio">${chaveNegocio}</param>
</result>

Otherwise...

enter image description here

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243