>From: "Hasan Turksoy" <[EMAIL PROTECTED]>
>
> hi all,
>
> commonsvalidator's "arg" argument used as the first argument of messages at
> validator-rules.xml... in my application, i'm using those "arg" arguments to
> hold some info(in general field's name) about my field which is being
> validated....
> it's like:
><h:inputtext ...>
> <s:commonsvalidator type="required" *arg="User Name"* ..... />
></h:inputtext ...>
> above code works as expected and gives appropriate validation message if
> that field is not valid (like: "User Name is required.")
>
> But, if i bind my "arg" argument to a key in my bundle, my message is being
> as "null is required.".. sample code is as below;
>
><h:inputtext ...>
> <s:commonsvalidator type="required" *arg="#{varMyBundle.lblUserName}"*.....
> />
></h:inputtext > I dive into code and find the problem & solution...
>ValidatorTag class is
>
> setting "arg" argument's value directly instead of evaluating the expression
> and putting the resulting value into it... Some of the arguments ("type",
> "message", "client", "server") are early binding at the tag class but not
> "arg" argument...
>
> shouldn't the "arg" argument set by early binding as above attributes? isn't
> this an issue?
>
I'm curious as to why the value from the resouce bundle doesn't exist at the
point the JSP tag is processed?
The reason for the late binding of the attributes is to handle the case where
the component is in a dataTable and the validation arguments need to be changed
for each row in the table.
I guess I just never thought there would be a usecase were someone wanted to
dynamically change the name of an input field on a form. Is that the scenario
you are talking about? Why do you need late binding on the "arg" property?
> regards,
>
> hasan..
> http://www.jroller.com/page/hasant
Gary