why the arg argument is not early binding?

2007-02-23 Thread Hasan Turksoy

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?

regards,

hasan..
http://www.jroller.com/page/hasant


Re: why the arg argument is not early binding?

2007-02-23 Thread Gary VanMatre
From: Hasan Turksoy [EMAIL PROTECTED] 

  
  
   
 is this code working with shale.1.0.4 version? can you verify it? 
 because, my code exactly same as above.. it's working with 1.0.2 version but 
 not with 1.0.4 version... there is no problem with my bundles.. because i 
 can see its value in a ... like: 


I'll try to take a look at it tonight.  Can you verify that the validator 
example in the shale-usecases [1] is not working [2] ?

--- snippet ---

h:inputText id=creditCard
size=11
   value=#{validate$test.creditCard}

val:commonsValidator
type=required
 arg=#{messages['prompt.creditCardNumber']}
 server=true
 client=false/

val:commonsValidator
type=creditCard
 arg=#{messages['prompt.creditCardNumber']}
  server=true
  client=false/

val:commonsValidator type=mask
   mask=[4-6].*

message=#{messages['validate.test.unknown.credit.card.type']}
 server=false
 client=true/

 /h:inputText

--- snippet ---


[1] http://people.apache.org/builds/shale/nightly/examples/ 
[2] 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-usecases/src/main/webapp/validator/test.jsp?view=markup
 
 
 hasan... 
 

Gary


 
 On 2/23/07, Gary VanMatre wrote: 
  
  From: Hasan Turksoy 
   
   this is not a dynamically changing value.. it is simply 
   internationalization!... instead of hard coding the field's name, i am 
   binding it to my bundle.. so that i can internationalize my app by using 
   bundles for my all messages, labels, field names, etc... 
   
  
  I see, then there should not be a problem. The following should work as 
  expected as long as there is a properties file supporting the locale. 
  
  
  

  
  
   hasan... 
   
  
  Gary 
  
   
   On 2/23/07, Gary VanMatre wrote: 

From: Hasan Turksoy 
 
 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: 
 
 
 
 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; 
 
 
   / 
 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