Meaningless Drivel is fun!*
The moose likes Struts and the fly likes How to pass a list of data to backend? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to pass a list of data to backend?" Watch "How to pass a list of data to backend?" New topic

How to pass a list of data to backend?

sebastian edwin

Joined: Nov 04, 2011
Posts: 1

To passing a list of data (array, arraylist etc) from backend to frontend is simple. But another way round, How to pass a list of data from frontend to backend?

I tried

var arr = [
{name: 'firstname', value: 'Hello'},
{name: 'lastname', value: 'World'}

var assignToIdSelectedArr = new Array();

var obj = {
status : "weldMachineModel"
var obj2 = [1,2,3];

type : 'POST',
url : "<s:url action="manageMaterial_test"/>",
dataType : 'json',
cache: false,
data: {
test : "test"
, mapExt : arr
success : function(data) {
error : function(XMLHttpRequest, textStatus, errorThrown) {
alert("Server connection error.");

In backend,
private String test;
private String[] testArr;
private List<String> testList = new ArrayList<String>();
private List<Material> materials = new ArrayList<Material>();
private List<Material> materialNOTs;

private Map map = new HashMap();
private Map<String, String> mapExt = new HashMap<String, String>();

But none of them can map to backend list / map, anyone can suggest me how to do that instead of using separator for long string?
sorry for bad english..

I agree. Here's the link:
subject: How to pass a list of data to backend?
Similar Threads
Strange Error with JSLT and JSON Taglib Array in JSP using "." (dot operator)
Display of hashmap values using jstl
Convert HashMap to Array in Struts
Mail API content type
Mail API content type