mercredi 1 avril 2015

Using Spring, I need to pass in dynamic data to html to build a web page

Been struggling on this a while, hope you guys can help.


I'm building a webpage using spring that needs to build a table using an api call that returns a dynamic number of elements.


Here is what I have now:



@RequestMapping(value="/managecustomerconfigurations", method=RequestMethod.GET)
public ModelAndView setUpPage(){
ModelAndView model = new ModelAndView("customerconfigurations");
model.addObject("cdata", custServe.listAllCustomers());
return model;
}


I can get cdata in my web page if I type



<p th:text="'Customer:' + ${cdata}" />


but I cannot see it if I just type



${cdata}


or if I put the data in any javascript (even if I use an onload method)


Quick sidenote: I am using html 5 not jsp.


Ideally I would want to pass in the api response into javascript and build a table based on that response.


Anyone have any suggestions?


edit: grammar


Aucun commentaire:

Enregistrer un commentaire