javascript - unable to recognize field - not marked as ignorable error - JSON - Java object -


i getting below error when try post input field values controller/method , convert json java object. couldn't figure out error is.

can 1 please me solve this?

error:

unrecognized field "userid" (class models.signupcred), not marked ignorable @ [source: n/a; line: -1, column: -1] (through reference chain: models.signupcred["userid"]) 

model:

import org.codehaus.jackson.annotate.jsonignoreproperties;     import com.google.code.morphia.annotations.id;  @jsonignoreproperties public class signupcred {     @id     string userid;     string firstname;     string lastname;     string langcode;     string email;     string password;     string residentcountrycode;     string contactprefemail; } 

javascript:

$(document).ready(function () {     $("#signup").click(function() {           var user = new object();         user.userid = $('#userid').val();         user.firstname = $('#firstname').val();         user.lastname = $('#lastname').val();         user.langcode = $('#langcode').val();         user.email = $('#email').val();         user.password = $('#password').val();         user.residentcountrycode = $('#residentcountrycode').val();         user.contactprefemail = $('#contactprefemail').val();          $.ajax({             url: "/submitsignup",             type: "post",             contenttype: "application/json",             data: json.stringify(user),                  success: function(data, textstatus, xhr) {                 var resp = json.parse(xhr.responsetext);                 window.location.replace(resp.message);             }          });       });    }); 

controller:

public result submitsignup()     {         jsonnode node = request().body().asjson();         signupcred signupdata=null;         try {             signupdata = objectmapper.readvalue(node, signupcred.class);             if (signupdata == null)                  return status(bad_request, genericutils.createerrorresponseasjson(bad_request, messages.get("error sign ac.java", "")));             string userid = signupservice.createuser(signupdata);             if(userid!=null)             {                 string usertype="myacct1";                 if (usertype!=null) {                     session(constants.usertype,usertype);                     session(constants.login_key, "myacct1");                 }}}           catch(exception e)         {             logger.error(e.getmessage());         }         return ok(index.render("login"));     } 

signup.scala.html:

<div class="login-input-container">                              <div class="error-message-container login" id="errormessagecontainer" style="display:none">            <p id="errormessage" class="error-text"></p>     </div>     <input id="userid" name="userid" type="text" placeholder="userid" autocomplete="off" class="inputtag"/>      <input id="firstname" name="firstname" type="text" placeholder="firstname" autocomplete="off" class="inputtag"/>             <input id="lastname" name="lastname" type="text" placeholder="lastname" class="inputtag" />     <input id="langcode" name="langcode" type="text" placeholder="en" class="inputtag" />     <input id="email" name="email" type="text" placeholder="email" class="inputtag" />     <input id="password" name="password" type="text" placeholder="password" class="inputtag" />     <input id="residentcountrycode" name="residentcountrycode" type="text" placeholder="iso country code" class="inputtag" />     <input id="contactprefemail" name="contactprefemail" type="text" placeholder="y" class="inputtag" />     <input type="button" class="btn" value="already user?" id="signin" onclick="/loginpage"/>     <input type="button" class="btn" value="sign up" id="signup"/>   </div> 

problem user.email. should user.email


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -