0

I have a textfield in my JSP like this -

<s:textfield name="chargeAmount" value="%{getText('{0,number,#,##0.00}', chargeAmount)}"/>
  1. The getText() takes care of formatting the number when the page is loaded. But, how do I format a number after I enter it into the textfield?

  2. How do I right-align the value in this textfield? I want it displayed right-aligned when the page is loaded and after I enter something into the textfield.

Thanks !!

Do Will
  • 711
  • 1
  • 9
  • 18

1 Answers1

1
  1. If you're looking to format the text in the web page, then you need to write javascript to do so. If you are looking to format it in the action class then see NumberFormat class

  2. See how to align texts inside of a input?

Community
  • 1
  • 1
nmc
  • 8,724
  • 5
  • 36
  • 68
  • Thanks nmc. Sounds like I have to do a JavaScript for formatting. I was wondering if Struts2 had some option. – Do Will Mar 17 '14 at 14:50