Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes purpose of javascript code in validator-rules.xml ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "purpose of javascript code in validator-rules.xml ?" Watch "purpose of javascript code in validator-rules.xml ?" New topic
Author

purpose of javascript code in validator-rules.xml ?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Hi,

In some validator-rules.xml files I have seen code like this:


whats the purpose of having javascript code along with validation rule?
what is cdata ?

Thanks.


Javardhan:
Manmohan Nayak
Greenhorn

Joined: Oct 18, 2006
Posts: 3
Hi when you want to do Client side validation with out going to server this java script will useful.
Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
How this Javascript will be used to do client side validations? Pls explain me in briref what and all we need to do for client side validations with this Javascript?

Nayak- you said without going server side we can do client side validation.
Validator-rules.xml file is available at server side only, then how the validation will happen at client side? Pls explain me the concept clearly.

Thanks.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I suggest that you jump over to Google and type in "struts client side validation". You are likely to find much more complete answer....plus you don't have to wait for a reply. If you have specific questions then feel free to post them here.

- Brent
Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Brent,

I have already done google serach on this, but all those links telling about enabling client side java script using <html:javascript> in jsp.

I dint find any information regarding this javascript existing in validator-rules.xml file. I want to know how can we utilise that javascript code at client side.

Please help.

Thanks.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Javardhan:

It is hard to follow your questions when you have so many different threads asking related questions. Have you figured out that in order to enable client-side validation for a custom validator you have to basically duplicate your validation in JavaScript? The Java code that you wrote only gets executed on the server side.

- Brent
Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Brent,

Now I understood the concept.

I have written javascript in validator-rules.xml, enabled client side javascript using <html:javascript> .
After running the application, I saw the code using 'view source'....all that java script code which I have written in validator-rules.xml is at client side now.

Thanks for your all replies.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: purpose of javascript code in validator-rules.xml ?
 
Similar Threads
Struts Validator Framework: problem with Custom Validator
Not able to understand some javascript written in validator-rules.xml
validator plug-in not working?
Struts Validator FrameWork = JavaScript Error
Validation