scala - Why lift triggers method? -
The Lift framework contains a simple form and a render method that handles the form:
DF render (xhtml: nodesec) = {var name = "" rear rue = "" human criteria "DEF register = {person = new person. Name = name person.roll = role person.com = if (human == "yes") "true" and "false" model. Create (individual) S.redirectTo ("/ index")} bind ("user", xhtml, ("name" -> smt ("Human" -> SHML text (human, human = _), ("roles" -> SHML.Text (role, role = _), ("roles" - (name, _ =)), ( "Submit" -> smtm.submit ("register", register))}
When I run this example, like I am using the URL that is used in this form , I get the following error:
Message: java.lang.ClassCastException: java.lang.String can not be entered in java.lang.Number .. .. ... epsilon.sjbs.CrudModel $ class.create (Sjbs.scala: 14) epsilon.sjbs.PersonM Odel.create (Sjbs.scala: 7) Epicelon. Sipp.PersonSnippet.register $ 1 (Snippet.scala: 33) epsilon.snippet.PersonSnippet.render (Snippet.scala: 41)
It seems that register method also There is no click on submitting even here, just why access to the URL?
Edit: this is my original unit
@NamedQuery (name = "findAll", query = "select x from person x") @ignee class person's ID {@OneToMany (mapped) = "person" with extension name, cascade = array (cascade type .Remove) attended by: java.util.List [participant] = new java.util.ArrayListParticipant var role: string = Roll.user wer man: string = _}
I think That person is human
a boolean
, not a str Ng
...
It looks like you are using something that looks like Mapper. If you are using Mapper, then I would like to do this:
def render (xhtml: nodecake) = {val person = person.create bind ("user", xhtml, " Name "- & gt; SHtml.text (person.name, person.name (_))," role "- gt; SHML.Text (person.fol, person.flow (_))," human "- & Gt; SHML.Text (if (person.com) is "yes" and "no", (human) => person.com (if (human == "yes") is true and false)), "submit "-> gt; SHtml.submit (" Register ", () => {person.save S.redirectTo (" / index ")}}
Bill Total personal preference, but the way you are using a clear wars
and it's current person
...
Comments
Post a Comment