struts-user mailing list archives

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

Hi,

I want to round a value during an interation:

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

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 ;)

cu
mathias
-- 
View this message in context: http://www.nabble.com/in-JSP%3A-rounding-values-tp24528871p24528871.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message