struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mathias-ewald <>
Subject in JSP: rounding values
Date Fri, 17 Jul 2009 05:36:36 GMT


I want to round a value during an interation:

<s:sort comparator="mapComparator" source="statsMap">
	<td><s:property value="" /><br>(Min: <s:property value="key.min"
/>, Max: <s:property value="key.max" />)</td>
		<s:set name="average" value="value.average" />
			int val = 0;
		<s:property value="val" />

As you can see, I iterate over a map. The value element of the map contains
a field named "averate". This average is a Float which I want to round
(Math.round()). I don't really know how to do that. I can find out how to
access the value from within <% %>. Once I have access to it, how can I
print that value? I never actually used <% %> tags.

Or ist there an easier way?

The whole idea if this code is to display ratings of serveral criteria where
a rating has a minimum value of key.min, a maximum of key.max and the
average rating is value.average. I want these values to be displays using
star icons. I am telling you this hoping there is a much easier way ;)

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message