ilovetolearn
ilovetolearn

Reputation: 2060

struts2 action redirect to servlet with parameters

I would like to find out if there is a way to redirect struts 2 action result to a servlet with the request parameters intact?

I am wondering if I can something similar like https://struts.apache.org/docs/dispatcher-result.html:

<result name="success" type="dispatcher">
  <param name="location">/MyServlet</param>
</result>

Upvotes: -1

Views: 1025

Answers (1)

Andrea Ligios
Andrea Ligios

Reputation: 50203

Struts2 is meant to be used with Actions.

When redirecting across actions with the redirectAction result, you can pass a fixed number of known parameters, assigning them both name and the value dynamically.

When redirecting to a Servlet with the redirect result, you can pass the parameters in the QueryString.

If you want to automatically grab an unknown number of parameters in the request and pass it to a Servlet, you should code it yourself. You're lucky though, I've already did it.

Upvotes: 2

Related Questions