Skip to content

Instantly share code, notes, and snippets.

@bigalnz
Created June 22, 2018 01:56
Show Gist options
  • Save bigalnz/50155af322a6c94f08e54510e39f9f1e to your computer and use it in GitHub Desktop.
Save bigalnz/50155af322a6c94f08e54510e39f9f1e to your computer and use it in GitHub Desktop.
....
<form action="#" th:action="@{/greeting}" method="post">
.....
@org.springframework.stereotype.Controller
@EnableAutoConfiguration
public class Controller {
@Autowired
nz.org.needsassessment.PdfGeneratorUtil pdfGenaratorUtil;
@GetMapping ("/")
String home() {
return "static/assessment.html";
}
@PostMapping("/greeting")
public String greetingSubmit() {
Map<String,String> data = new HashMap<String,String>();
data.put("name","James");
try {
pdfGenaratorUtil.createPdf("greeting",data);
} catch (Exception e) {
e.printStackTrace();
}
return "finished";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment