简体   繁体   中英

Get dynamic column data(i.e. without getter setter in action classes) in struts action classes

I am new in struts development.

I had created a project in which i have requirement to create a dynamically N number of fields. so it's bean/pojo will not be available.

I have to take input for these dynamic fields in jsp and retrieve those fields in struts2 action classes.

How can i take data of dynamically created table's fields in struts2 action classes.

example-: user will create action.
one action have many goals and user can define 1 to n measures for goal.
I'll create a form to take input for these measures using jsp.
i want all form data of measures in action classes.
so i don't have getter & setter.

Any suggetion will be helpful, Thanks

To Read all request parameter send from client side to server side you can get it by using ServletRequest.getParameterMap()

For Example :

Map<String, String[]> requestParams = request.getParameterMap();  

By this you got the all your form parameters in key-value pair. Iterate this Map and get your parameter value.

I not aware of your table structure in which you want to insert your value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM