cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Royal <pro...@managingpartners.com>
Subject substituting sitemap parameters from FormValidatorAction
Date Wed, 09 May 2001 21:08:51 GMT
I've got the following in my sitemap:

                         <map:match pattern="detail">
                                 <map:act type="form-validator">
                                         <!-- parameter's for validator -->
                                         <parameter name="descriptor" 
value="context://accounting/bankaccounts/validation_descriptors.xml"/>
                                         <parameter name="validate" 
value="id"/>

                                         <!-- what to do now -->
                                         <map:generate type="serverpages" 
src="detail.xfrm">
                                                 <parameter 
name="objectPath" value="/BankAccount[id={id}]"/>
                                         </map:generate>
                                         <map:transform 
src="../../xsl/form.xsl" type="xslt"/>
                                         <map:serialize type="html"/>
                                 </map:act>
                                 <map:redirect-to uri="list"/> <!-- if the 
validator fails, redirect to list -->
                         </map:match>

The id attribute gets properly validated as a Long, and then is available 
as a sitemap parameter. Thing is, FormValidatorAction casts its parameters 
to whatever datatype they were validated as. In the substitute method of 
AbstractSiteMap it would attempt to cast all sitemap parameters as strings, 
and failing on the Long from FormValidatorAction. Below is a patch to 
remove that cast. The StringBuffer has a version of the append method that 
accepts Object, so that should still work. If this patch is on the wrong 
end (ie FormValidatorAction should only return  a map of Strings, let me 
know). Thanks!
-peter

Index: AbstractSitemap.java
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
retrieving revision 1.1.2.39
diff -r1.1.2.39 AbstractSitemap.java
220c220
<                     result.append((String)((Map)list.get(k)).get(s));
---
 >                     result.append(((Map)list.get(k)).get(s));
222c222
< 
result.append((String)((Map)list.get(k)).get(s.substring(m+1)));
---
 >                     result.append(((Map)list.get(k)).get(s.substring(m+1)));
225c225
<                        + " as " + (String)((Map)list.get(k)).get(m == -1 
? s : s.substring(m+1)));
---
 >                        + " as " + ((Map)list.get(k)).get(m == -1 ? s : 
s.substring(m+1)));


-- 
peter royal -> proyal@managingpartners.com
managing partners, inc. -> http://www.managingpartners.com


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message