title: Assigning/Passing value from Java function to JS/JQuery function
body: <p>Lets say I have a Java function something like</p>
  
  <pre><code>public int getNumber(){
  
  }
  </code></pre>
  
  <p>which returns some value based on it's logic. And I have a JS file something like</p>
  
  <pre><code>Tapestry.Validator.amountValidator = function(field, message) {
  
      field.addValidator(function(value) {
          if (value != null) {
            // code here
              }
          }
      });
  
  };
  </code></pre>
  
  <p>Now I am asking myself is it possible in JS or JQuery to pass value from Java function to it's function(value) in JS and if so, how can it be achieved?</p>
  
  <p>UPDATE: As suggested by abalos answer, Tap for myself has already done 3 out of 4 stages for it. I am providing a function that deals with server side and logic behind it.</p>
  
  <pre><code>   @InjectComponent
      private TextField amount;
      @Inject
      private FieldValidatorSource fieldValidatorSource;
  
      public FieldValidator&lt;?&gt; getAmountValidator() 
       {
          return fieldValidatorSource.createValidators(amount, "required,max=" + getBroj());
      }
  </code></pre>
  
  <p>Now here validator is taken from a logic inside a function getBroj(), which is maximum number of what it takes. And this works like a charm on server side. Now I was thinking that what I don't have( using my logic ) is only Client side, and I can achieve it by updating current Validation class from Tapestry that will handle with this kind of request yet known to that class. And to do it I would need to call a js file with a function calling something like above in the example, but I am not quite sure how to pass value from getNumber() function to the JS function above.</p>