struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maurizio Cucchiara <maurizio.cucchi...@gmail.com>
Subject Re: @VisitorFieldValidator message formatting question.
Date Thu, 09 Dec 2010 17:32:02 GMT
At first glance everything would seems correctly configured (except
for that unnecessary RequiredFieldValidator).
Did you try it in a more recent version (like 2.2.1)?


2010/12/9 RogerV <roger.varley@googlemail.com>:
>
>
> 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Maurizio Cucchiara

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


Mime
View raw message