Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

strut bean write tag

 
Monoj Barma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This is a snippet of my jsp page using struts tags. When the jsp page displays, the value of 'totalNumber'(data type is long) bean property is appended with (unknown) just before the value. Say, if the totalNumber value is 100 it displays as (unknown)100. Anyone has got any clue on this?
This is happening only for long data type.

thanks in advance!

[CODE]
//All struts tld's import statement here

<tiles:importAttribute name='bean'/>
<tiles:useAttribute name="property" classname="java.lang.String"/>
<bean efine id='activityInfo' name='bean' property='<%= property %>'/>
<tiles:useAttribute name="javascript" classname="java.lang.String"/>
<tiles:useAttribute name="label" classname="java.lang.String"/>
<tr>
<td align=left height=20>
<logic:notEqual name='activityInfo' property='totalNumber' value='0'>
<a href="<%=javascript%>">
<b><%= label%></b></a>
</logic:notEqual>
<logic:equal name='activityInfo' property='totalNumber' value='0'>
<b><%= label%></b>
</logic:equal></td>
<td align=right ><bean:write name='activityInfo' property='totalNumber'/> </td>
<td align=right colspan="2"><bean:write name='activityInfo' property='displayAmount'/> </td>
</tr>

[CODE]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never seen (unknown) appended to a value before, but here's one thing you might try: create a public String getFormattedTotalNumber() method on your bean that converts the long value to a String and returns it. Then change the property on your bean:write to "formattedTotalNumber".
[ January 11, 2006: Message edited by: Merrill Higginson ]
 
Monoj Barma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merrill!
I will try that!
 
Monoj Barma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Merril!

I got the solution!
just added format='' and that removes the (unknown)

[CODE] <td align=right ><bean:write name='activityInfo' property='totalNumber' format=''/> </td>
[CODE]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic