wood burning stoves 2.0*
The moose likes Struts and the fly likes Indexed properties and html:javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Indexed properties and html:javascript" Watch "Indexed properties and html:javascript" New topic

Indexed properties and html:javascript

Henrik Lund

Joined: Nov 28, 2003
Posts: 9

I've just managed to set up indexed properties and server-side validation in my Struts application. My bean is called AddUserBean and contains a ArrayList named userListArray with User objects (name, ...).

The problem is that the client-side validation (using html:javascript) doesn't work as expected (see below). I'm using the Jakarta Commons Validator plug-in.

This is how my validation.xml looks like:

And this is from my JSP:

The generated HTML code from the html:javascript looks like:

Anyone got some idea of why the Javascript validation doesn't work, and the server-side does?

Is it even poosible to have client-side validation when using indexed properties? Maybe there is a bug in the Validator plugin?

rogel garcia
Ranch Hand

Joined: Dec 19, 2003
Posts: 41
The client side validation for indexed properties on struts was not done! You will have to change something in the struts to enable javascript validation on indexed properties. This link shows you how to do that http://www.vleite.net/rogel/javascriptValidation.htm
Any doubts write to the email on the article

SCJP 1.4
Peterneo Andersonneo

Joined: Mar 22, 2006
Posts: 5

This link is not accessible can some body tell how to do client side validations on indexed properties.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Do you have the following in your <html:form> tag?

onsubmit="return validateUserFormBean(this)"

If not, that's the problem.

Consultant, Sima Solutions
Peterneo Andersonneo

Joined: Mar 22, 2006
Posts: 5
>>Do you have the following in your <html:form> tag?

>>onsubmit="return validateUserFormBean(this)"

>>If not, that's the problem.

Ya, I have all there even I am able to see the javascript getting generated through <html:javascript> but the bowrser shows script error on submitting the form.
rogel garcia
Ranch Hand

Joined: Dec 19, 2003
Posts: 41
Sorry about the broken link...


This link is a ZIP file with all the necessary files
rogel garcia
Ranch Hand

Joined: Dec 19, 2003
Posts: 41


HTML Version

I agree. Here's the link: http://aspose.com/file-tools
subject: Indexed properties and html:javascript
Similar Threads
Validation failure
Validator framework
Client-side validation isn't working for me!!
STRUTS: client-side validation in jsp using DynaValidatorForm