Daniel Robertus
Daniel Robertus

Reputation: 1102

JSTL format String with Mask

is anybody know how to format String with mask using jstl tags? let say you want to show confidential credit card number in list and you just want to show first 4 digit and else will be masked with * something like :

1234-****-****-****

Upvotes: 1

Views: 2347

Answers (1)

cmbaxter
cmbaxter

Reputation: 35463

I don't think there is anything out of the box to do this. The fmt namespaced tags are about formatting numbers and dates and i18n stuff, but nothing about string formatting. If you don't want to be doing this in your presentation layer with scriptlets or function invocations, you might want to consider adding another model property for the obfuscated CC number that way you can do the formatting in Java where it will be much easier.

Upvotes: 2

Related Questions