This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 63232
    
  69

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: 1517
    
    6
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: 63232
    
  69

I also think it's a good practice to use the standard means over the proprietary means even when using a framework.
 
Have you checked out Aspose?
 
subject: JSTL tag with bean:write tag
 
It's not a secret anymore!