JSP to Struts 2 Information passing...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JSP to Struts 2 Information passing...

Gazoo101
Hey again forum folks,

I have a question regarding information passing from a regular JSP file to Struts 2. Normally, when passing information, I would just create a form with the proper action tag fitting to the action struts 2 will recognize. Then, creating the proper get and set functions along with a private variable on the struts 2 side would properly update all the variables when struts 2 kicks in and performs whatever actions are necessary.

However, I am currently working on a page where the user has the ability to dynamically add and remove various form fields. The id's of these fields are to be dynamically generated. Something along the line of newusername1, newusername2, newusername3 and so forth. As an added twist, there may be holes in-between the sequence, so newusername8 may not exist, but newusername9 will.

But I'm getting ahead of myself - the problem is, I don't know how to properly access values from form fields that are not present statically when the page has been created. How do I, in struts 2, access these values if they're created dynamically?

Regards,

Gazoo
Reply | Threaded
Open this post in threaded view
|

Re: JSP to Struts 2 Information passing...

vinodkashyap
Administrator
Hi

You can refer to the ParameterInterceptor of struts 2
Reply | Threaded
Open this post in threaded view
|

Re: JSP to Struts 2 Information passing...

Gazoo101
Hey,

Thanks for the help... I found this somewhat out-of-date code here:

http://www.koders.com/java/fidBF945200A5A4EB017A34473E819C3330ACE2257B.aspx

and managed to piece together the pieces myself...

Thanks again...

Regards,

Gazoo