java - creating array in javascript from array object pass in by request.setAttribute in servlet -
i'm trying create dynamic photo gallery retrieve photo's location mysql. store location photo object under name 'private string location;
' there arraylist hold different photos. after, servlet forward jsp page
request.setattribute("list", list); request.getrequestdispatcher("car.jsp").forward(request, response);
i have java script photo gallery takes in array of, ["path_to_image", "optional_link", "optional_linktarget", "optional_textdescription"].
imagearray: [ ["path_to_image", "optional_link", "optional_linktarget", "optional_textdescription"], ["a.jpg", "www.a.com", "", ""] ],
i retrieve location object in list passed in servlet , convert imagearray photo gallery work.
i'm quite new javascript , i've been looking around similar example or tutorial couldn't find relevant ones. please me out, thank time.
what question photo object of class , location member variable of class.
request.setattribute("list", list); request.getrequestdispatcher("car.jsp").forward(request, response);
is list
arraylist of photo
object or location
member variable.
also setting attribute in java , want list hold javascript. in case can check json holding java object , convert javascript object.
you string in json similar {imagearray:[{"path_to_image":"path_to_image","optional_link":"optional_link","optional_linktarget":"optional_linktarget","optional_textdescription"}]}
Comments
Post a Comment