This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "strut bean write tag" Watch "strut bean write tag" New topic
Author

strut bean write tag

Monoj Barma
Greenhorn

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!

[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

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 ]

Merrill
Consultant, Sima Solutions
Monoj Barma
Greenhorn

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

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>
[CODE]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: strut bean write tag
 
Similar Threads
how to apply continue statement in struts logic:iterate tag
pass a variable in the URl
logic:present not working??????
List Objects in Form Bean has null values...mostly
bean value persists on clicking back