thebug...@gmail.com
unread,Jul 9, 2008, 9:01:33 PM7/9/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SweetScala
These are on my mind. I want to let developer do the following when
processing a form:
class MyController extends FormController {
handle("/newUser"){ (req, form) =>
val user = new User(form("firstName"), form("lastName"),
form("email"))
//do ... something with user
View("/newUser", "user"-> user)
}
}
On our end, we need the handle action to be consistent with existing
Controller trait. This allow the abstraction to have a change to
extract the form object out of request before passing back into the
closure.
The definition of Form class will be something like this:
class Form(req: Req) {
def apply(name: String){
req.getRequiredParam(name)
}
}
Of course we need to pimp up the normal HttpServletRequest to have
following methods for general use
#getRequiredParam(name: String): String // throw exception if now
found.
#getOptionalParam(name: String) : Option[String]
What do you think?