*
The moose likes JSP and the fly likes JSTL tag with bean:write tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL tag with bean:write tag" Watch "JSTL tag with bean:write tag" New topic
Author

JSTL tag with bean:write tag

Yashwant Palkar
Greenhorn

Joined: Dec 01, 2010
Posts: 20
I want to use <fmt:formatNumber> with <bean:write> tag in JSP. Please find the following code snippet



For this above error I am getting this error.

"org.apache.jasper.JasperException: XYZ.jsp(49,64) equal symbol expected"


I am not sure it is right or wrong. Can anybody suggest me proper syntax for this?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60749
    
  65

You can't use one custom tag within another custom tag. Rather than the proprietary <bean:write> tag use the EL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
While you can't use one custom tag as an attribute to another custom tag, you can nest them, and the <fmt:formatNumber> tag supports that use case explicitly:



Having said that though, the equivalent of the bean:write tag should just be ${name.property} ie: ${sb.accountNumber}
So in this case I would go with the EL expression and the value attribute.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60749
    
  65

I also think it's a good practice to use the standard means over the proprietary means even when using a framework.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL tag with bean:write tag
 
Similar Threads
JSTL fmt:formatNumber does not display currency
Using javascript as attribute
error with the body of fmt:formatNumber
roman numerals
Formatting a value