0

My problem is, I want to pass a parameter which is a List to my location.href

function addNewDriver() 
{
    var pEntityType = <%=c.WIDOC_ENTITY_DRIVER%>;
    var pListEntities = <%=lListDrivers%>;
    location.href= "<%= c.url %>do/user/groupItemForm.step1.jsp?idClient=" + <%=pIdClient%> + "&listEntities:" + pListEntities + 
"&idGroup=" + <%=pIdGroup%> + "&entityType=" + pEntityType + "&<%= lBackButtonUrl %>";  
}

This is an example in Chrome console.

var pListEntities = [{dniPerson=4444444S, surname2Person=XXX, passportPerson=null, namePerson=XXX, idGroupItem=1, idPk=1111, surname1Person=XXXX};

This is how I think "they" wanted it.

var pListEntities = [{dniPerson:4444444S, surname2Person:XXX, passportPerson:null, namePerson:XXX, idGroupItem:1, idPk:1111, surname1Person:XXXX}; 

"lListDrivers" is already filled with values of each driver, like dni, name, surname etc. The problem comes because, to pass this list, values inside can't have an equal, they need a ":", but I don't know any way to change it.

1 Answers1

0

Convert your List<Map> to JSON. you can use Jackson ObjectMapper to convert it and it will change your pListEntities to a JSON object.

Here is one example.

YoManTaMero
  • 391
  • 4
  • 10