Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error with the body of fmt:formatNumber

 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

Hi,


I checked api for fmt:formatNumber and found that we can use JSP in body..

but when I am trying to put anything in thr body of <fmt:formatNumber></fmt:formatNumber >

its throwing error with message that invalid body..

Can anyone help me with this.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, JSP is allowed in the body of formatNumber. Can you send the exact error message, and the way you are using the tag ?
 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

This is the line of the code without bodya dn its working fine..
<td nowrap class="tCellnum"><fmt:formatNumbervalue="${element.extra.dealLevelAmount}" pattern="###,###.##"></fmt:formatNumber></td>


but when I am putting boy in this tag..like

<td nowrap class="tCellnum"><fmt:formatNumbervalue="${element.extra.dealLevelAmount}" pattern="###,###.##">N/A</fmt:formatNumber></td>


I am gettign this error ---

Encountered illegal body of tag "fmt:formatNumber" tag, given its attributes.</p>

..Please help me with this.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
N/A ?? Did you try with a number ? N/A is not a number.
 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , I tried with number also but I am getting same error.. One more thing I got on this is if I am removing value attribute from tag and putting anything in body its working fine..

I put like


<td nowrap class="tCellnum"><fmt:formatNumber pattern="###,###.##">100</fmt:formatNumber></td>

and it worked .. But If I am putting

<td nowrap class="tCellnum"><fmt:formatNumbervalue="${element.extra.dealLevelAmount}" pattern="###,###.##">100</fmt:formatNumber></td>

I am getting invalid body error( same error)...
 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the error "Encountered illegal body of tag "fmt:formatNumber" tag, given its attributes.</p>
"

it seems if we are putting "value" attribute then we can't put anything in body...as the error says illegal body of tag given its attribute .. but Ia have guessed this now sure..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right, you cannot use both value and body content. You've got to choose one.
 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for confirmation
 
Shashi Prakash
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for confirmation
 
Everybody's invited. Even this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!