Neil Aggarwal wrote:
Hello:

I have this scenario:

I have a form in a jsp file that submits to an
ActionSupport class.

The ActionSupport class captures the submitted
data and validates the input.  If the data is valid,
it sends the user back a redirect to a servlet url
to give them the data file generated for their
input (It is a CSV file).

Right now, I am taking all of the fields from the
ActionSupport class and appending them manually to
the redirect url so I can have their values in the
servlet.

This becomes tedious if there are many fields in the
ActionSupport class.

Is there a way to grab the instance of the ActionSupport
class from the servlet?  If so, I could eliminate the
need to append the fields.

I can probably use a session variable to temporarily
hold the ActionSupport instance, but it seems there
should be a more Struts-centric way to get it.

Any suggestions?

My first suggestion would be to get rid of the redirect to a separate servlet and serve the CSV response directly from the action. Is there a reason you can't do that?

There's no way your servlet can get the action class instance, since action instances are request scoped; the instance no longer exists in the new request the servlet receives.

Your options in this case (or any other case where you want to use data from one request in a subsequent request) are pretty much limited to either including the data in the redirect URL's query parameters, as you are doing, storing them in the user's session, as you suggested, or persisting them somewhere else, such as a database.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to