Re: "`javascript' is not supported as a JSP scripting language."
JavaJosh <[email protected]> Thu, 11 May 2006 01:15:54 -0700
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Organization | JavaJosh Enterprises, LLC |
| Message-ID | <[email protected]> |
Mattias Jiderhamn wrote: > JavaJosh wrote: >> This is changing with the rise of 'AJAX' websites. ... My goal is to >> execute the same form validation code on the client and on the server. > > The point with AJAX is that you call the server code (Java) from the > client side, rather than using the client side code (JavaScript) on the > server. Consider a hypothetical application that consists purely of a set of URLs, each of which which take an XML request and return something. These endpoints should not trust that the caller is correctly sending those XML requests, and therefore each requires validation checking. It is valuable to tell the client that an error is being committed as soon as possible, so we move that logic closer to the client. Currently this consists of writing validation code in two languages(or 3 or 4 or 5 if you consider XML Schema or DTDs or custom validation markup to be languages) each of which must be independently maintained. It would be valuable to use the same code insofar as possible in both places. In a perfect world that code would be in Java, but we must make due for the least common denominator: JavaScript. An alternative is to use a 3rd validation rule representation which can be used to generate code in the desired target language. AFAIK this is the idea behind the Eclipse Modeling Framework. As neat as this sounds, it seems like a better idea is to use the ubiquity of JavaScript.