I wanted to declare an action in such a way that I could pass String
array of static params. I tried the below code:
<action name="saveRecord" class="saveRecordAction">
<result name="success" type="tiles">tiles:saveRecordSuccess</result>
<param name="names">name1</param>
<param name="names">name2</param>
<param name="names">name3</param>
</action>
I have a setter in my action class:
public void setNames(String[] name){
mNames = name;
}
But I am only receiving one name which is the last one, "name3"
.
Is what I wanted possible? If yes, what is the correct way of doing it?
The struts static param works like MAP. name been the KEY and value as VALUE. You can achieve your requirement by sending the values as comma separated and you can split it so that you can have your array there.
<param name="names">name1,name2,name3</param>