This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes strut bean write tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "strut bean write tag" Watch "strut bean write tag" New topic

strut bean write tag

Monoj Barma

Joined: Oct 20, 2005
Posts: 9
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!

//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"/>
<td align=left height=20>
<logic:notEqual name='activityInfo' property='totalNumber' value='0'>
<a href="<%=javascript%>">
<b><%= label%></b></a>
<logic:equal name='activityInfo' property='totalNumber' value='0'>
<b><%= label%></b>
<td align=right ><bean:write name='activityInfo' property='totalNumber'/> </td>
<td align=right colspan="2"><bean:write name='activityInfo' property='displayAmount'/> </td>

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Consultant, Sima Solutions
Monoj Barma

Joined: Oct 20, 2005
Posts: 9
Thanks Merrill!
I will try that!
Monoj Barma

Joined: Oct 20, 2005
Posts: 9
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>
I agree. Here's the link:
subject: strut bean write tag
Similar Threads
List Objects in Form Bean has null values...mostly
pass a variable in the URl
how to apply continue statement in struts logic:iterate tag
logic:present not working??????
bean value persists on clicking back