cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject accessing a HashMap from JXTemplate
Date Fri, 08 Aug 2003 19:46:52 GMT
Hi All,

In my model, validation errors on a FormBean are added to a HashMap 
that is a property of that FormBean.

ie.

if (getName() == null || "".equals (getName()) || DEFAULT_NAME.equals 
(getName ())) {
	mErrors.put (Constants.NAME_FIELD, "Please enter a proper name");
}

I then expected to be able to extract these errors from JXTemplate like 
this:

<t:if test="#{form/errors[constants/NAME_FIELD] != ''}">
	<span style="color:red">#{form/errors[constants/NAME_FIELD]}</span>
</t:if>

but it does not output anything, so I tried this :

<t:forEach items="#{form/errors}">
	<tr valign="top">
		<td>#{name()}</td>
		<td>#{.}</td>
	</tr>
</t:forEach>

but got unexpected results :

<tr valign="top">
	<td>{name=Please enter a proper name}</td>
	<td>{name=Please enter a proper name}</td>
</tr>


Anyone work out what I am doing wrong?

thanks for any help

regards Jeremy


Mime
View raw message