playframework - Is it good to pass java map to view instead of form? -
what best practices? good? or better pass models view form wrapper? think?
this depends on use case have. both passing model instance , model instance wrapped in form have advantages.
as kris pointed out, having form gives access validation errors , on. accessing fields directly model of course, on other hand, simpler model instance.
please don't pass maps data (something map[string, object]
) - if can work objects, it, that's idea of oo.
in summary: if template deals form manipulation (editing, submission, ...) - use model wrapped in form. if want display data or similar - grab model instance , provide view, without additional overhead.
Comments
Post a Comment