struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gawain Hammond" <>
Subject RE: ajax validation issue
Date Thu, 11 Sep 2008 16:52:08 GMT
Right, that has been an interesting romp around in struts.

Jeromy, thanks for pointing me in the right direction and making me
think. I went back to basics, bit the bullet and improved my javascript
jedi abilities by installing firebug. That has really helped.

If this might help anyone else one day in the future, here's what

It turns out my client validation was NOT working quite right. There
were two issues:

1.) validation.js was missing in my html, I wasn't using <sx:head> which
seems to be the only tag that generates a src path to it, I was using
<s:head> which afaik was my only choice in Upgrading to 2.1.2
resolved this.

I had to put this in manually:

<script type="text/javascript" src="/myapp/struts/xhtml/validation.js">

2.) I discovered that some of my validation regex was treated slightly
differently in js and in java (I had to mess around with grep on the
command line to experiment a bit, but grep regex worked the same as js
regex), thus meaning that some validation rules were never caught
client-side and were only being caught server-side, hence the validation
inconsistency I encountered. The server side validation then led to my
form element population problem on the next page after the initial form.
With client side validation working well I can use the action tags to
populate form elements as much as I want again.

So, does anyone have any idea why using an action won't populate form
elements after validation returns the form input? (the listAll method is
never invoked in the example below)

Like so:

> <s:action namespace="/admin" name="crud.Group.listAll"
> ...
> <s:select label="Group" name="" value="%{}" 
>   list="%{#groupAction.list}" listKey="id" listValue="name"/>

Many thanks for your assistance.
This transmission is strictly confidential, possibly legally privileged, and intended solely
for the 
addressee.  Any views or opinions expressed within it are those of the author and do not necessarily

represent those of, i-CD Publishing (UK) Ltd or any of it's subsidiary companies.
 If you 
are not the intended recipient then you must not disclose, copy or take any action in reliance
of this 
transmission. If you have received this transmission in error, please notify the sender as
soon as 
possible.  No employee or agent is authorised to conclude any binding agreement on behalf
i-CD Publishing (UK) Ltd with another party by email without express written confirmation
by an 
authorised employee of the Company. (Tel: 08000 192 192).  i-CD Publishing
(UK) Ltd 
is incorporated in England and Wales, company number 3148549, VAT No. GB 673128728.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message