Pergunta

I need to pass a parameter from an action to the other one, but it runs into following error.

Messages:   
There is no Action mapped for namespace [/Product/Product] and action name [desc] associated with context path [].

struts.xml

 <package name="MyProducts" extends="default" namespace="/Product/Find">
 <result name="Desc" type="redirectAction">
                <param name="actionName">../Product/desc</param>
                <param name="id">${id}</param>
 </result>
 ....

 <package name="Product" extends="default" namespace="/Product">
    ..........

In the first action (in namespace /Product/Find) I am setting the id which has getter and setter.

In the second action (in namespace /Product) I have a id variable and getter and setter.

Foi útil?

Solução

Add another ../ to your address try this ../../Product/desc

or

I know what he means, I thought I just need to answer your question not providing any other approach,

   <result name="YOUR RESULT NAME" type="redirectAction">
           <param name="actionName">desc</param>
           <param name="namespace">/Product</param>
   </result>

Do not forger to precede the namespace name with a / otherwise it does not work. To redirect to an action in default package use / as your namespace param.

Outras dicas

The best option will be that you can set the variable in session using session object and then can access that session in the redirected action class..Any way i am looking for your answer by passing variable in the redirect action only...Hoping it was helpful to you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top