Skip to content Skip to sidebar Skip to footer

Submit Js Function Value On Submit In Struts 2

How to pass values set inside hidden field in by JavaScript function to action class on click of button of this ?

Solution 1:

The values should be in the CSV format like in this answer.

That will also give you an idea about type of property which you should bind to the hidden field. For example you can use List<Integer> or Integer[] for the property that set the values 25, 27, 28.

Struts2 has a built-in converter that converts such values to the list or array automatically.

Also note the instance variable in the action class can't be used by OGNL (by default) if it is not accessible by security manager or has not public accessors like getters and setters. In Struts2 submitted values are populated to the instance variable by the params interceptor which is indeed invokes OGNL to do the job.

Post a Comment for "Submit Js Function Value On Submit In Struts 2"