Help me to write spring web application to read from a file and display as a html page
jQuery(document).ready(function($){
$.ajax({
url : "../xml.txt",
type:"POST",
dataType: "text",
success : function (data) {
$('<pre />').text(data).appendTo('div');
window.location.href=contextPath+"http://localhost:8080/subin.html"
}
});
});
how to support this with spring ????
my controller class is
@Controller
@RequestMapping("/data")
public ModelAndView helloWorld() {
return new ModelAndView("hello", "message", "Spring MVC Demo");
}
@RequestMapping(value = "/data", method = RequestMethod.POST)
public @ResponseBody String getData(@RequestParam String name) {
String result = br.readLine();
return result;
}
}
controller
code ?