> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/OSHroPIhK0oJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.
--
Guillaume Bort
On Thu, Apr 5, 2012 at 3:12 PM, Leonard Punt <leona...@gmail.com> wrote:
> Forgot to mention that I'm using Java. So you mean that I should write some
> kinda 'form bean' class for each form? Sounds Strut-ish :P
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/Lkh3jSzwHQgJ.
Well I don't see any better solution. Defining a representation for
each form you have with the according validation rules is the simplest
and cleanest way.
On Thu, Apr 5, 2012 at 3:12 PM, Leonard Punt wrote:
> Forgot to mention that I'm using Java. So you mean that I should write some
> kinda 'form bean' class for each form? Sounds Strut-ish :P
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/Lkh3jSzwHQgJ.
>
--
Guillaume Bort
Actually is it almost the same for both Java and Scala. In Scala you
define a form specifying names and validation functions, and the
apply/unapply function to bind/unbind the form value to your model
value.
In Java it feels less natural, but it is equivalent: a class with
fields and validation annotations, and methods to bind/unbind your
model value.
> https://groups.google.com/d/msg/play-framework/-/S4IFt50fVcsJ.
> You're right, you need some way to define the form and the corresponding
> validation rules. The Scala API to do this is very nice, leveraging some of
> the language features Scala provides.
>
> However, the Java Forms API feels a bit clunky. It requires creating beans
> for every case, and then copying data from that bean once the binder and
> validator have done their thing.Actually is it almost the same for both Java and Scala. In Scala you
define a form specifying names and validation functions, and the
apply/unapply function to bind/unbind the form value to your model
value.In Java it feels less natural, but it is equivalent: a class with
fields and validation annotations, and methods to bind/unbind your
model value.