I just had a need to do this and a Google search didn't immediately turn up a solution. So I thought for a couple of minutes and came up with this:
value="0#{numberVar}"
This takes advantage of the way Java auto-converts objects to strings when doing a concatenation. So if your number is 13, Java EL turns this into new String("0"+13), which becomes "013". You can then strip off the leading zero or just parse the string back into a number.
Comments
Post a Comment