문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top