aspose file tools*
The moose likes Struts and the fly likes html:javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:javascript" Watch "html:javascript" New topic
Author

html:javascript

Nicola Guy
Ranch Hand

Joined: Jun 23, 2004
Posts: 91
Hi there

I'm just implementing validation using the validator and when I include the <html:javascript formname="xxxx"> tag it displays the contents of the javascript in my validation.xml.

Why

Thanx for any help you lot can give
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
The Struts Validator, in some form, has been available since the days of Struts 0.5. It was orignally packaged as a developer contribution. Later, the core code was moved to the Jakarta Commons and a Struts specific extension became part of Struts since 1.1.

For the convenience of the many developers who have been using the Struts Validator all along, this document first overviews the core functionality and then covers the changes and new functionality added since Struts 1.1.

Once you have configured the Validator Plug-In, so that it can load your Validator Resources you just have to extend org.apache.struts.validator.action.ValidatorForm instead of org.apache.struts.action.ActionForm. Then when the validate method is called, the action's name attribute from the struts-config.xml is used to load the validations for the current form. So the form element's name attribute in the validator-rules.xml should match action element's name attribute.

Another alternative is to use the action mapping you are currently on by extending the ValidatorActionForm instead of the ValidatorForm. The ValidatorActionForm uses the action element's path attribute from the struts-config.xml which should match the form element's name attribute in the validator-rules.xml.

Then a separate action can be defined for each page in a multi-page form and the validation rules can be associated with the action and not a page number as in the example of a multi-page form in the validator example.



Struts Validation Framework use Custom Tag to implement this solution so if you need to know how this work.
Se detail in struts-html.tld and source of validation in struts.jar (org\apache\struts\validator package)

Gook luck.

---- you can download source code of struts from Apache Jakarta Struts website. ------


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:javascript