There is no way to get communication between the script and the jsp code
since
they run in different environments.  What you can do is generate a static
array/vector
in your script while the page is being generated by the JSP (this array will
contain
all the possible valid values from the bean - as it can be examined by the
JSP).

The array then is accessible to the JAVASCRIPT function at the client site,
and
can be used to validate input.  The tradeoff is that the user has visible
access
to the source, and can determine exactly what values you are comparing.

-AMT

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of David Wall
> Sent: Wednesday, December 15, 1999 6:22 PM
> To: [EMAIL PROTECTED]
> Subject: Re: client-side validations with JSP
>
>
> >     You need to use javascript. Here is a cheesy example:
> > THE SCRIPT
> > <script>
> > function checkFields() {
> >  theValue = document.forms[0].whatever.value;
> >  if (isNaN(theValue) == true) {
> >   alert("Whatever must be numeric!");
> >   document.forms[0].whatever.value = "";
> >   }
> > }
>
>
> Is there a way to make the Javascript talk with the java beans at the time
> of JSP page creation?  That is, suppose my bean has a list of valid values
> for a field.  I want the Javascript to check that a field when
> POSTed is one
> of those valid values.  How do I make the transfer of the
> information in the
> java bean into an Array or the like in Javascript?
>
> David
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to