This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Problem with Struts+JavaScript validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with Struts+JavaScript validation" Watch "Problem with Struts+JavaScript validation" New topic
Author

Problem with Struts+JavaScript validation

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
I'm developing Struts_1.1 based wizard application starting from page=1.
I set appropriate validation requirements in validations.xml.
Server-side validaton works OK, but JavaScript validation doesn't occur at all.
JavaScript validation would work, but I have to rewrite my application to start from page=0; Even than, validation would work only for the first step (page=0).

What is going on?
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
JavaScript validation would work, but I have to rewrite my application to start from page=0; Even than, validation would work only for the first step (page=0).


Why do you say that?
Are you doing the following (assuming you are using the page number approach, one form bean containing all pages' fields)?
1. hidden control which specifies the page number
<html:hidden property="page" value="1"/>
2. Use "page" attribute for each "field" in the validation.xml to specify the page number on which the field belongs.

Alternately you could use ValidatorActionForm for multi-page forms.

Sheldon Fernandes
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Yes, I'm using all of that.
I also use page property of my ValidatorActionForm bean in its reset method.
Maybe it is some bug in the Struts release I have.
I'm using Struts release packed with examples that can be found on the CD shipped with the book "Struts in action".

Could someone give me a link to the latest release of Struts 1.1?
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982

Could someone give me a link to the latest release of Struts 1.1?


You can download Struts 1.1 final release at here:
http://www.apache.org/dist/jakarta/struts/binaries/

Nick
[ November 09, 2004: Message edited by: Nicholas Cheung ]

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
In addition, you might also be interested in upgrading Struts to 1.2.4.
http://struts.apache.org/download.cgi

Nick
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Is there any tutorial/article on how to migrate from Struts 1.1 to Struts 1.2?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Struts+JavaScript validation