How to submit a form that has data for 2 models on Spring and let it validate them? -
suppose have 2 tables: users , preferences.
users table has columns username, password , email.
preferences table has columns contact_me_by_email, contact_me_by_phone_call, contact_me_by_sms.
each table has it's own model (user , preferences).
i want present 1 page users when fill in data in form data validated , populate both tables.
i'm able parameters 1 form accessing request object , manually performing validations , proceed according results get.
also, can use @validate annotation validate models when present 2 pages user (each page having 1 model - first page contains data user model , second 1 contains data preferences).
i'm struggling discover way present 1 page form contains fields both models above validated spring using @validate annotation.
is possible? there other annotation i'm not aware of it?
any appreciated.
regards.
so, here user mode class :
@entity @table(name = "user") public class user(){ // fields of user annotated @column , fields of preferences annotated @transient below : @transient private string favoritetvshow; //getters , setters both }
this way need submit 1 form. enjoy.
Comments
Post a Comment