Hi

i have a question on formatting the output through <bean:write>. my ActionForms contains all the String datatype variable, even though the value in this varibles may be a date or number. i declared all varibles as string datatype because from the UI when the user enters the date if i won't declare it as a string datatype it need to be keyed in some particular format. if this is the case how can i use 'format' in the <bean:write format="###,###.00"/>

Thanks
usha

David M. Karr wrote:

"Norman" == Norman Klein <[EMAIL PROTECTED]> writes:

Norman> I currently have a nested iterate loop which looks like the following:

Norman> <nested:iterate id="liabilities" name="OverviewForm"
Norman> indexId="liabilityIndex" property="liabilities">
Norman> <tr id="lib_<%=liabilityIndex%>_Header" class="appSubHeader">
Norman> <td valign="MIDDLE">
Norman> <nested:text name="liabilities"
Norman> property="unpaidBalance" />
Norman> </td>
Norman> </nested iterate>

Norman> This works fine, but the "unpaidBalance" field really needs to be formatted
Norman> like this: $100,000.00 instead of 100000.0

Norman> Since the text tag doesn't directly support a format field, I generally use
Norman> this trick:

Norman> <input type="text" name="loan.FFFCFee" size="8" maxlength="150"
Norman> value="<bean:write name="overviewForm" property="loan.FFFCFee"
Norman> format="###,###.00" /> ">

Norman> The "value" field is used to supply the necessary formatting capability.

Norman> but the following doesn't seem to work:

Norman> <nested:text name="liabilities" property="unpaidBalance"
Norman> value="<nested:write name="liabilities" property="unpaidBalance"
Norman> format="###,###,###.00" />" />

Norman> and only generates the following error message:

Norman> Error: Attribute: liabilities" is not a valid attribute name
You have a couple of problems here.

First, you can't nest a custom tag in the attribute value of a custom tag.
You'll have to put the nested value into either a scriptlet variable or a
scoped attribute, and just emit the value as part of the attribute value.

Second (this will probably go away when you fix the first problem), you're
nesting double quotes inside double quotes. If you have an attribute value
that has to quote something inside the value, then the attribute value needs to
use different quotes than the internal quotes.





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to