Permalink
Browse files

fixing json code

  • Loading branch information...
1 parent 250a1a5 commit 10d2d041e6505b391358ca07dc384a6de154b9b0 @retroryan retroryan committed Jan 24, 2012
Showing with 20 additions and 20 deletions.
  1. +20 −20 app/controllers/Application.java
@@ -2,8 +2,8 @@
import models.Bar;
+import org.codehaus.jackson.JsonNode;
import play.data.Form;
-import play.mvc.Content;
import play.mvc.Controller;
import play.mvc.Result;
import views.html.index;
@@ -12,25 +12,25 @@
public class Application extends Controller {
- public static Result index() {
- return ok(index.render("Enter the name of your new bar:", form(Bar.class)));
- }
+ public static Result index() {
+ return ok(index.render("2 Enter the name of your new bar:", form(Bar.class)));
+ }
- public static Result addBar() {
- Form<Bar> form = form(Bar.class).bindFromRequest();
- if (form.hasErrors()) {
- return badRequest(index.render("Error in Bar form. Enter new Bar", form(Bar.class)));
- } else {
- Bar bar = form.get();
- bar.save();
- return ok(
- index.render("The bar " + bar.name + " was saved. Enter a new Bar:", form(Bar.class))
- );
- }
- }
+ public static Result addBar() {
+ Form<Bar> form = form(Bar.class).bindFromRequest();
+ if (form.hasErrors()) {
+ return badRequest(index.render("Error in Bar form. Enter new Bar", form(Bar.class)));
+ } else {
+ Bar bar = form.get();
+ bar.save();
+ return ok(
+ index.render("2 The bar " + bar.name + " was saved. Enter a new Bar:", form(Bar.class))
+ );
+ }
+ }
- public static Result listBars() {
- Content content = toJson(Bar.findAll());
- return ok(content);
- }
+ public static Result listBars() {
+ JsonNode jsonNodes = toJson(Bar.findAll());
+ return ok(jsonNodes);
+ }
}

0 comments on commit 10d2d04

Please sign in to comment.