Ryan
Ryan

Reputation: 53

bindFormRequest() encounter a cannot find symbol error in Play 2.0.3

I create a form with Play framework. but I get a error: cannot find symbol I reviewed the example codes in play directory, still can not figure it out. by the way, can I use Play to access PostgresSQL in heroku? This is following code:

This is piece of code in /controllers/Application.java

    final static Form<Geo> geoForm = form(Geo.class);

    public static Result showDBpage(){

          //get problem here :-<
          Form<Geo> filledForm = geoForm.bindFormRequest(); 
          Geo loc = filledForm.get();
          return ok(database.render(loc));
        }

This is conf/routes:

POST    /database   controllers.Application.showDBpage()

views/database.scala.html

@(loc: Geo)

@main("") {

    <p>This is Database pages</p>

    <p>@loc.longitute and @loc.latitute</p>

    <a [email protected]>Back to form</a>
}

models/Geo.java:

package models;

import java.util.*;
import javax.validation.*;
import play.data.validation.Constraints.*;

public class Geo
  {
    @Required
    public String longitute;
    @Required
    public String latitute;

    public Geo()
    {

    }

    public Geo(String longitude,String latitute)
    {
        this.longitute = longitute;
        this.latitute = latitute;
        //this.length = length;
    }
  }

Upvotes: 3

Views: 1120

Answers (1)

biesior
biesior

Reputation: 55798

There is NO method bindFormRequest() but bindFromRequest() - you have a typo in your code.

Check the API http://www.playframework.org/documentation/api/2.0.2/java/play/data/Form.html

Upvotes: 7

Related Questions