You can display a credit card number as a series of number groupings. You determine the number of items in each grouping by setting the groupingsize attribute. For example:

<dsp:valueof bean="CreditCard.number"converter="creditCard" groupingsize="4"/>

This example might render a credit card number with four numbers in each grouping as follows:

7845 5624 5586 1313

In general, you only want full display of a credit card number when a user enters it initially in order to facilitate visual confirmation. Afterward, you might only want to display portions of it so a user can recognize it without jeopardizing the user’s privacy. With numcharsunmasked, you can indicate how many numbers you want to unmask, counting from right to left. The masking character is X, unless you specify otherwise using the maskcharacter attribute.

Here are some examples:

Tag

Result

<dsp:valueof bean="CreditCard.num"
 converter="creditCard" numcharsunmasked="4"/>

XXXXXXXXXXXX3456

<dsp:valueof bean="CreditCard.num" converter="creditCard"
maskcharacter="*" numcharsunmasked="12"/>

****567890123456

 
loading table of contents...