<action name="AddedPaid" class="iland.payment.SupplierPaidAction" method="insert">
<result name="success" type="redirect">ShowPaid</result>
<result name="input">/pages/payment/addToPay.jsp</result>
<result name="login">/pages/login.jsp</result>
</action>
<action name="ShowPaid" class="iland.payment.SupplierPaidAction" method="fetchAllByfk">
<result name="success">/pages/paid/showPaidDetails.jsp</result>
<result name="input">/pages/payment/ShowPay.jsp</result>
<result name="login">/pages/login.jsp</result>
</action>
Here AddedPaid
Action is used to add form data in to database.
After adding data in to database I am redirecting result to ShowPaid
action.
This is working properly.
Now I want whenever I redirect AddedPaid
action to ShowPaid
.
ShowPaid
must show data of perticular supplierPaymentId
for which I have added data in AddedPaid
.
After redirect it is howing url
http://localhost:8082/ClothStore/ShowPaid
I want
http://localhost:8082/ClothStore/ShowPaid?supplierPaymentId=4
First of all use
redirectAction
result instead ofredirect
to redirect to another action. And useparam
tag to add parameters in your result configuration.Note you need to have getter/setter for
supplierPaymentId
in your action class.It's strange, usually people have 2 and want 1 :)
Btw, since you are using PostRedirectGet, you need to manually pass the parameter in Struts configuration.
Assuming you have a variable named
supplierPaymentId
with getter and setter, it's achievable like follows:Also use redirectAction instead of redirect, that is meant to be used to redirect to external URLs or non-Action URLs