I have a List of Strings built using Javascript on the client side which looks like this in the Javascript console:
["No address provided.", "No telephone number provided."]
I send this to my Controller as one of the params from my GSP in an ajax call but the controller sees it like this:
No address provided.,No telephone number provided.
ie as a String (without square brackets). This is how I am sending my params:
<button id="save" onclick = "${remoteFunction(controller: 'customer',
action: 'saveModifiedIndividualRecord',
params: '\'uniqueId=\' + uniqueId + \'&secondaryId=\' + secondaryId + \'&redIssuesRemoved=\' + removedRedIssues + \'&yellowIssuesRemoved=\' + removedYellowIssues')}"> Save </button>
Any way so that the Controller will see it as a List and not a String?
Am guessing both red or yellow issues are you list of string params. So Try def listOfRedIssue = params.list('redIssuesRemoved') .. this makes it as List or yellowIssues
Try this in your controller:
def redIssuesRemoved = params.redIssuesRemoved.tokenize(",")
def yellowIssuesRemoved = params.yellowIssuesRemoved.tokenize(",")
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.