public @ResponseBody ModelAndView getControllerAndServer(ModelAndView model,@RequestParam("siteId") Integer siteId) {
String serverIp= null;
Integer port = null;
List<Object[]> serverAndController = controllerDao.getControllerAndServerInfo(siteId);
Map <String, ControllerDao> map = new HashMap <String, ControllerDao>();
int i=0;
Object[] result = serverAndController.get(i);
if(result!=null)
{
serverIp=(String)result[7];
model.addObject(serverIp);
port = (Integer)result[8];
model.addObject(port);
}
if(map.containsKey(siteId)){
map.get(serverIp);
map.get(port);
}
return model;
}
答案 0 :(得分:0)
您必须使用model.addObject("Key", "value")
方法来存储这些值:
serverIp=(String)result[7];
model.addObject("serverIp",serverIp);
port = (Integer)result[8];
model.addObject("port",port);
有关更多信息,请参阅Javadoc of ModelAndView
您可以使用${serverIp}
和${port}
将其添加到视图中。