Saturday 5 September 2015

Give an example where you need JSP Custom Tag?

Let’s say we want to show a number with formatting with commas and spaces. This can be very useful for user when the number is really long. So we want some custom tags like below:
<mytags:formatNumber number="123456.789" format="#,###.00"/>
Based on the number and format passed, it should write the formatted number in JSP page, for above example it should print 123,456.79
We know that JSTL doesn’t provide any inbuilt tags to achieve this, so we will create our own custom tag implementation and use it in the JSP page.

No comments:

Post a Comment