title: How can I set my back end values to my form text field in play framework
body: <p>I created a login page..if the user is already registered, the login will work and it redirect to profile page..After submitting values in profile, the data will store in database. Again the same user is going to login, it will showing the blank profile page to fill. But it will show the user filled details. For this, I just get the unique profile id who is logged in and fetch the details of that user. But I don't know how to set that details to my front end form text field by using the "value" attribute in html.For Eg, I get the last name and set it into one variable in my controller.</p>
  
  <p>This is my Controller:</p>
  
  <pre><code>   package controllers;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import models.ForgotPassword;
  import models.Profile;
  import models.Register;
  
  import org.apache.commons.mail.EmailException;
  
  import play.Logger;
  import play.data.Form;
  import play.libs.F.Promise;
  import play.libs.OpenID;
  import play.libs.OpenID.UserInfo;
  import play.mvc.Controller;
  import play.mvc.Result;
  import views.html.*;
  import views.html.index;
  import views.html.login;
  import views.html.profile;
  
  import com.typesafe.plugin.MailerAPI;
  import com.typesafe.plugin.MailerPlugin;
  
  
  public class Application extends Controller {
  
      public static Result index() {
          return ok(index.render("Your new application is ready."));
      }
  
      public static Result signup() {
          return ok(login.render("fghj"));
  
      }
  
      public static Result register() {
  
          Register register = Form.form(Register.class).bindFromRequest().get();
          register.save();
          return ok(login.render("ghjk"));
      }
  
      public static Result login() {
          Register register = Form.form(Register.class).bindFromRequest().get();
          String uname = register.getUsername();
          String pass = register.getPassword();
          List&lt;Register&gt; login = Register.find.where().eq("username", uname)
                  .eq("password", pass).findList();
          if (login.isEmpty()) {
              return unauthorized("Please register and try login");
          } else {
              session().clear();
              session("registerId", +login.get(0).getRegisterId() + "");
              return ok(app.render("wsdfghjk"));
               }
      }
  
      public static Result home() {
          return ok(app.render("fghjk"));
      }
  
      public static Result menu() {
          String reg=session().get("registerId");
          Profile profile1=Profile.find.byId(reg);
          String last=profile1.getLastname();
          return ok(profile.render("" ,profile1));
          //return ok(profile.render(""));
  
  
      }
  
      public static Result logout() {
          return ok(index.render("fhjk"));
      }
  
      public static Result profile() {
          Profile profile = Form.form(Profile.class).bindFromRequest().get();
          profile.getRegister().setRegisterId(
                  Integer.parseInt(session().get("registerId")));
  
          profile.save();
          return ok();
      }
  
      public static Result forgotPassword() {
  
          return ok(forgotPassword.render("eghj"));
      }
  
      public static Result email() throws EmailException {
          ForgotPassword forgotPass = Form.form(ForgotPassword.class)
                  .bindFromRequest().get();
          String emailId = forgotPass.getEmail();
          System.out.println(emailId);
          MailerAPI  mail = play.Play.application().plugin(MailerPlugin.class).email();
             mail.setSubject("mailer");
             mail.setRecipient(emailId);
             mail.setFrom("sindhu.raja90@gmail.com");
             mail.send( "text" );  
             return ok("gg");
  
  
      }
  
      @SuppressWarnings("serial")
      public static final Map&lt;String, String&gt; identifiers = new HashMap&lt;String, String&gt;() {
          {
              put("google", "https://www.google.com/accounts/o8/id");
          }
      };
  
      @SuppressWarnings("deprecation")
      public static Result auth() {
          Logger.debug("authenticate");
          String providerId = "google";
          String providerUrl = identifiers.get(providerId);
          String returnToUrl = "http://localhost:9000/login/verify";
          if (providerUrl == null) {
              return badRequest("Could not find provider " + providerId);
          }
  
          Map&lt;String, String&gt; attributes = new HashMap&lt;String, String&gt;();
          attributes.put("Email", "http://schema.openid.net/contact/email");
          attributes
                  .put("FirstName", "http://schema.openid.net/namePerson/first");
          attributes.put("LastName", "http://schema.openid.net/namePerson/last");
  
          Promise&lt;String&gt; redirectUrl = OpenID.redirectURL(providerUrl,
                  returnToUrl, attributes);
          return redirect(redirectUrl.get());
      }
  
      public static Result verify() {
          Logger.debug("verifyLogin");
          System.out.println("verify execuited");
          Promise&lt;UserInfo&gt; userInfoPromise = OpenID.verifiedId();
          userInfoPromise.get();
          return ok(profile.render("ert"));
      }
  
  }
  </code></pre>
  
  <p>In the value attribute I made mistake I think so anybody please correct it. I am not using the form helper template.
  Html code:</p>
  
  <pre><code>  @(message: String,profile1: Profile)
  @main("") {
  &lt;div class="container test"&gt;
  
      &lt;!-- form: --&gt;
      &lt;section&gt;
          &lt;div class="col-lg-8 col-lg-offset-2"&gt;
              &lt;label&gt; &lt;a href="@routes.Application.home()"&gt;Home&lt;/a&gt;
              &lt;/label&gt; 
              &lt;label&gt; &lt;a href="@routes.Application.logout" class="logout"&gt;Logout&lt;/a&gt;
              &lt;/label&gt;
  
              &lt;div class="page-header"&gt;
                  &lt;h2&gt;Profile&lt;/h2&gt;
  
              &lt;/div&gt;
  
              &lt;form class="form-horizontal" method="POST" id="profile"
                  action="@routes.Application.profile()"&gt;
                  &lt;div class="input-group"&gt;
                      &lt;input type="file" class="file"&gt;
                  &lt;/div&gt;
  
                  &lt;div class="sample"&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="firstName"&gt;First
                              Name:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="text" class="form-control" name="firstname" value=""
                                  id="firstName" autocomplete="off" required
                                  data-bv-notempty-message="The first name is required" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="middleName"&gt;Middle
                              Name:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="text" class="form-control" name="middlename"
                                  autocomplete="off" id="middleName"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="lastName"&gt;Last
                              Name:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
  
                              &lt;input type="text" class="form-control" name="lastname" value='profile1.getLastname'
                                  id="lastName" autocomplete="off" required
                                  data-bv-notempty-message="The last name is required" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label"&gt;Date of Birth:&lt;/label&gt;
                          &lt;div class="col-xs-4"&gt;
                              &lt;input type="date" class="form-control" name="dob" id="dob"
                                  autocomplete="off" data-bv-date="false"
                                  data-bv-date-message="The birthday is not valid" required
                                  data-bv-notempty-message="The date of birth is required" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label"&gt;Gender:&lt;/label&gt;
                          &lt;div class="col-xs-2"&gt;
                              &lt;label class="radio-inline"&gt; &lt;input type="radio"
                                  name="gender" value="male" required
                                  data-bv-notempty-message="The gender is required" /&gt; Male
                              &lt;/label&gt;
                          &lt;/div&gt;
                          &lt;div class="col-xs-2"&gt;
                              &lt;label class="radio-inline"&gt; &lt;input type="radio"
                                  name="gender" value="female"&gt; Female
                              &lt;/label&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="maritalStatus"&gt;Marital
                              Status: &lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;select class="form-control" name="maritalStatus"&gt;
  
                                  &lt;option value="single"&gt;Single&lt;/option&gt;
                                  &lt;option value="married"&gt;Married&lt;/option&gt;
                                  &lt;option value="divorced"&gt;Divorced&lt;/option&gt;
  
                              &lt;/select&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="permanentAddress"&gt;Permanent
                              Address:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;textarea rows="3" class="form-control" name="permanentAddress"
                                  id="permanentAddress" required
                                  data-bv-notempty-message="The permanent address is required"&gt;&lt;/textarea&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="tempAddress"&gt;Temporary
                              Address:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;textarea rows="3" class="form-control" name="tempAddress"
                                  id="tempAddress" required
                                  data-bv-notempty-message="The temporary address is required"&gt;&lt;/textarea&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="bloodGroup"&gt;Blood
                              Group:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="text" class="form-control" name="bloodGroup"
                                  id="bloodGroup" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="idMark"&gt;Identification
                              Mark:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="text" class="form-control" name="identificationMark"
                                  id="idMark" autocomplete="off" /&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="personalNo"&gt;Personal
                              No:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="tel" class="form-control" name="personalNum"
                                  id="personalNo" autocomplete="off" required
                                  data-bv-notempty-message="The phone no is required"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="emergencyNo"&gt;Emergency
                              No:&lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="tel" class="form-control" name="emergencyNum"
                                  id="emergencyNo" autocomplete="off" required
                                  data-bv-notempty-message="The phone no is required"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="location"&gt;Location:
                          &lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;input type="text" class="form-control" name="location"
                                  id="location" autocomplete="off"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="state"&gt;State: &lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;select class="form-control bfh-select-fix bfh-states"
                                  name="state"&gt;&lt;/select&gt;
  
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label class="col-lg-3 control-label" for="state"&gt;Country:
  
                          &lt;/label&gt;
                          &lt;div class="col-lg-4"&gt;
                              &lt;select class="form-control bfh-countries" name="country"
                                  data-country="US" id="country-selector"&gt;&lt;/select&gt;
  
  
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;div class="col-xs-offset-3 col-xs-9"&gt;
                              &lt;input type="submit" class="btn btn-primary" value="Submit"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/section&gt;
  
  &lt;/div&gt;
  
  
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $('#profile').bootstrapValidator();
          var form=document.getElementById("profile")
          form.reset();
  
      });
  
  &lt;/script&gt;
  &lt;style type="text/css"&gt;
  .form-horizontal .control-label {
      text-align: left;
  }
  
  .test .input-group .btn-default,.form-control.file-caption,.glyphicon,.close
      {
      display: none;
  }
  
  .sample {
      margin-bottom: 50px;
  }
  
  .test .btn-file:hover {
      background: #ffffff;
      border: none;
  }
  &lt;/style&gt;
  }
  </code></pre>
  
  <p>Profile.java in Models:
  package models;</p>
  
  <pre><code>import java.util.Date;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.OneToOne;
  import javax.persistence.Table;
  
  import play.db.ebean.Model;
  
  @Entity
  @Table(name = "profile")
  public class Profile extends Model {
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L; 
  
      @Id
      @GeneratedValue(strategy=GenerationType.SEQUENCE,generator ="profile_profile_id_seq")
      private int profileId;
  
  
      public int getProfileId() {
          return profileId;
      }
  
      public void setProfileId(int profileId) {
          this.profileId = profileId;
      }
      @OneToOne
      @JoinColumn(table="register", name= "register_id")
      private Register register;
  
      private int registerId;
      public Register getRegister() {
          return register;
      }
  
      public void setRegister(Register register) {
          this.register = register;
      }
  
      public Profile(){
          register = new Register();
      }
      private byte[] photo;
      @Column(name="firstname")
      private String firstname;
      private String middlename;
      private String lastname;
      private Date   dob;
      private String gender;
      private String maritalStatus;
      private String permanentAddress;
      private String tempAddress;
      private String bloodGroup;
      private String identificationMark;
      private String personalNum;
      private String emergencyNum;
      private String location;
      private String state;
      private String country;
  
  
  
      public byte[] getPhoto() {
          return photo;
      }
  
      public void setPhoto(byte[] photo) {
          this.photo = photo;
      }
  
      public String getIdentificationMark() {
          return identificationMark;
      }
  
      public void setIdentificationMark(String identificationMark) {
          this.identificationMark = identificationMark;
      }
  
      public String getPersonalNum() {
          return personalNum;
      }
  
      public void setPersonalNum(String personalNum) {
          this.personalNum = personalNum;
      }
  
      public String getEmergencyNum() {
          return emergencyNum;
      }
  
      public void setEmergencyNum(String emergencyNum) {
          this.emergencyNum = emergencyNum;
      }
  
      public String getFirstname() {
          return firstname;
      }
  
      public void setFirstname(String firstname) {
          this.firstname = firstname;
      }
  
      public String getMiddlename() {
          return middlename;
      }
  
      public void setMiddlename(String middlename) {
          this.middlename = middlename;
      }
  
      public String getLastname() {
          return lastname;
      }
  
      public void setLastname(String lastname) {
          this.lastname = lastname;
      }
  
  
  
      public Date getDob() {
          return dob;
      }
  
      public void setDob(Date dob) {
          this.dob = dob;
      }
  
      public String getGender() {
          return gender;
      }
  
      public void setGender(String gender) {
          this.gender = gender;
      }
  
      public String getMaritalStatus() {
          return maritalStatus;
      }
  
      public void setMaritalStatus(String maritalStatus) {
          this.maritalStatus = maritalStatus;
      }
  
      public String getPermanentAddress() {
          return permanentAddress;
      }
  
      public void setPermanentAddress(String permanentAddress) {
          this.permanentAddress = permanentAddress;
      }
  
      public String getTempAddress() {
          return tempAddress;
      }
  
      public void setTempAddress(String tempAddress) {
          this.tempAddress = tempAddress;
      }
  
      public String getBloodGroup() {
          return bloodGroup;
      }
  
      public void setBloodGroup(String bloodGroup) {
          this.bloodGroup = bloodGroup;
      }
  
  
      public String getLocation() {
          return location;
      }
  
      public void setLocation(String location) {
          this.location = location;
      }
  
      public String getState() {
          return state;
      }
  
      public void setState(String state) {
          this.state = state;
      }
  
      public String getCountry() {
          return country;
      }
  
      public void setCountry(String country) {
          this.country = country;
      }
  
      public String toString() {
          StringBuilder stringBuilder = new StringBuilder();
  
  
          stringBuilder.append("Profile[Photo=");
          stringBuilder.append(photo);
          stringBuilder.append(",ProfileId=");
          stringBuilder.append(profileId);
          stringBuilder.append(",FirstName=");
          stringBuilder.append(firstname);
          stringBuilder.append(",MiddleName=");
          stringBuilder.append(middlename);
          stringBuilder.append(",LastName=");
          stringBuilder.append(lastname);
          stringBuilder.append(",Dob=");
          stringBuilder.append(dob);
          stringBuilder.append(",Gender=");
          stringBuilder.append(gender);
          stringBuilder.append(",MaritalStatus=");
          stringBuilder.append(maritalStatus);
          stringBuilder.append(",PermanentAddress=");
          stringBuilder.append(permanentAddress);
          stringBuilder.append(",TempAddress=");
          stringBuilder.append(tempAddress);
          stringBuilder.append(",BloodGroup=");
          stringBuilder.append(bloodGroup);
          stringBuilder.append(",IdentificationMark=");
          stringBuilder.append(identificationMark);
          stringBuilder.append(",PersonalNum=");
          stringBuilder.append(personalNum);
          stringBuilder.append(",EmergencyNum=");
          stringBuilder.append(emergencyNum);
          stringBuilder.append(",Location=");
          stringBuilder.append(location);
          stringBuilder.append(",Country=");
          stringBuilder.append(country);
          stringBuilder.append(",State=");
          stringBuilder.append(state);
          stringBuilder.append(",Register Id=");
          stringBuilder.append(register != null ? register.getRegisterId() : "");
  
          stringBuilder.append("]");
          return stringBuilder.toString();
  
      }
      public int getRegisterId() {
          return registerId;
      }
  
      public void setRegisterId(int registerId) {
          this.registerId = registerId;
      }
      public static Finder&lt;String, Profile&gt; find = new Finder&lt;String, Profile&gt;(
              String.class, Profile.class);
  
  
  }
  </code></pre>
  
  <p>This what I am getting in console:</p>
  
  <pre><code>           [error] /home/e100085/Software/play-2.2.3/myApps/app/controllers/Application.java:142: error: method render in class profile cannot be applied to given types;
  [error]                 return ok(profile.render("ert"));
  [error]                                  ^
  [error]   required: String,Profile
  [error]   found: String
  [error]   reason: actual and formal argument lists differ in length
  [error] Note: /home/e100085/Software/play-2.2.3/myApps/app/controllers/Application.java uses or overrides a deprecated API.
  [error] Note: Recompile with -Xlint:deprecation for details.
  [error] 1 error
  [error] (compile:compile) javac returned nonzero exit code
  [error] application - 
  
  ! @6j0a93m46 - Internal server error, for (GET) [/] -&gt;
  
  play.PlayExceptions$CompilationException: Compilation error[error: method render in class profile cannot be applied to given types;]
          at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
          at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfun$apply$16.apply(PlayReloader.scala:304) ~[na:na]
          at scala.Option.map(Option.scala:145) ~[scala-library-2.10.4.jar:na]
          at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:304) ~[na:na]
          at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(PlayReloader.scala:298) ~[na:na]
          at scala.Option.map(Option.scala:145) ~[scala-library-2.10.4.jar:na]
  [warn] play - No application found at invoker init
  </code></pre>