Skip to content

Instantly share code, notes, and snippets.

@taywils
Created November 10, 2013 20:33
Show Gist options
  • Save taywils/7403558 to your computer and use it in GitHub Desktop.
Save taywils/7403558 to your computer and use it in GitHub Desktop.
spark_blog_step_3_2
post(new Route("/article/update/:id") {
@Override
public Object handle(Request request, Response response) {
String title = request.queryParams("article-title");
String summary = request.queryParams("article-summary");
String content = request.queryParams("article-content");
Integer id = Integer.parseInt(request.queryParams("article-id"));
for(Article article : HelloSpark.articles) {
if(id.equals(article.getId())) {
article.setTitle(title);
article.setContent(content);
article.setSummary(summary);
}
}
response.status(200);
response.redirect("/");
return "";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment