I made a simple app using spring framework i want to pass class object from controller(backend) to frontend
backend code
@RequestMapping("/searchBook.htm")
public ModelAndView searchBook(HttpServletRequest request,
HttpServletResponse response) throws Exception
{
Fruit f = new Fruit();
f.setName("apple");
f.setPrice(20);
request.setAttribute("fruit",f);
}
frontend :
${fruit.name}
what's the best way to pass class object from backend to frontend ?