Maurizio Cucchiara wrote:
> 
> Sorry,
> I meant annotated *classes*
> 

Sure, BaseAction - all other actions extend this;

@ParentPackage(value = "admin")
@Result(name="start",location="add-new-user-flow.jsp")
public class AddNewUserFlow extends ActionSupport implements SessionAware,
Preparable,
                                                                                
                                ValidationAware {

        private static final long serialVersionUID = 1L;
        private Map<String, Object> session;
        private NewUserDTO newUserDto;

        @Override
        public void prepare() throws Exception {
                newUserDto = (NewUserDTO) session.get("NEWUSERDTO");
        }
        
        @Action(value="start-create-user") 
        public String startConversation() {
                newUserDto = new NewUserDTO();
                session.put("NEWUSERDTO", newUserDto);
                return "start"; 
        }
        

        @Override
        public void setSession(Map<String, Object> session) {
                this.session = session;
        }

        
        @VisitorFieldValidator(appendPrefix=true, message="my message")
        public NewUserDTO getNewUserDTO() {
                return newUserDto;
        }

        
        public void setNewUserDto(NewUserDTO addNewUserDto) {
                this.newUserDto = addNewUserDto;
        }

        public Map<String, Object> getSession() {
                return session;
        }

}


The NewUserDTO

public class NewUserDTO {

        private String userName;
        private String email;
        private int serialNumber;
        private List<License> licenses;
        private Authority authority;
        private Password password;
    
    @Autowired
    private UserJpaController userdao;
    
    public NewUserDTO() {
        this.licenses = new ArrayList<License>();
    }
    
        public String getUserName() {
                return userName;
        }
        @RequiredFieldValidator(message="User Name is required")
        @RequiredStringValidator(message="User Name is required")
        public void setUserName(String userName) {
                this.userName = userName;
        }

... more getters & setters.
-- 
View this message in context: 
http://old.nabble.com/%40VisitorFieldValidator-message-formatting-question.-tp30405050p30417733.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to