Thanks for the reply. There should definately be some sort of enhancment to the <s:text> tag. I found a more susinct solution with the <fmt:formatNumber> tag - it doesn't display the "null" text if the value is null. Anyone know if there is a request to add a "null" feature to <s:text>? The <s:date> tag handles "null" without displaying "null" text. Wonder why <s:text> is different? I can't think of many situations where the UI calls for displaying "null" when a value being displayed is in fact null.
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <fmt:formatNumber value="${xaction.listPrice}" type="currency" maxFractionDigits="0"/> <s:date name="#xaction.closingDate" format="MMM dd, yyyy" /> On Sat, Nov 7, 2009 at 4:02 PM, Samuel Robert <samuelrobert....@gmail.com> wrote: > Hi, > > I have had same problems when displaying dates. > The only solution I found was quite similar but maybe a little more flexible > since you can choose to display nothing: > <s:property value="#item.referenceDate != null ? > getText('format.date',{#item.referenceDate}) : ' '" escape="false"/> > > Samuel > > 2009/11/7 Burton Rhodes <burtonrho...@gmail.com> > >> The following entry works fine, but when "xaction.contractPrice" is >> NULL it prints out "null" on my web page. >> <s:text name="format.money"><s:param >> value="#xaction.contractPrice"/></s:text> >> >> This sort of fixes the issue, but I would prefer to not display a "$0". >> <s:text name="format.money"><s:param >> value="%{#xaction.contractPrice==null ? 0 : >> #xaction.contractPrice}"/></s:text> >> This does not work as I get an error: "cannot forward object as a number" >> <s:text name="format.money"><s:param >> value="%{#xaction.contractPrice==null ? ' ' : >> #xaction.contractPrice}"/></s:text> >> >> Properties file entry: >> format.money = {0,number,\u00A4###,##0} >> >> Is there something simple I am missing or a better way to do this? Is >> there a "$!" like freemarker or a "default value" parameter? >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org