Thanks James I'll investigate on extending PropertyModel.

Currently I'm doing the following:

public class UserRegistrationPage extends WebPage {
        @SpringBean
        private UserService userService;

        private FeedbackPanel feedbackPanel;
        private UserDto userDto; // only has the User properties
        
        @SuppressWarnings("unchecked")
        public UserRegistrationPage() {
                feedbackPanel = new FeedbackPanel("feedback");
                userDto = new UserDto();
                CompoundPropertyModel userDtoModel = new 
CompoundPropertyModel(userDto);
// bind to the DTO
                
                Form registrarForm = new Form("registerForm", userDtoModel){
                        @Override
                        protected void onSubmit() {
                                try {
                                        // Create a real User and obtain the
data from the DTO
                                        User user = new 
User(userDto.getEmail(), 
                                                                                
userDto.getName(), 
                                                                                
userDto.getPassword(), 
                                                                                
userDto.getBirth());
                                        userService.save(user); // service 
calls the dao which actually saves
to DB
                                } catch (Exception e) { // The Businness 
Exception has the message error
                                        feedbackPanel.warn(e.getMessage());
                                }
                        }
                };      

                registerForm.add(new TextField("email").setRequired(true)); // 
form binded
to the DTO properties
                ...
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to