Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

can't declare instance of DecimalFormat  RSS feed

 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to format integers to include commas in the proper places, but when I declare an instance of DecimalFormat, I get an error. I have imported java.text.*....
<%
DecimalFormat df = new DecimalFormat(###,###);

String appYear = request.getParameter("appyear");
String[] appName = { "Deposit Account App","Loans -","Small Business Deposits" };
String[] month = { "1","2","3","4","5","6","7","8","9","10","11","12" };
..etc, ..etc
%>

I'm new to jsp, so I'm not sure if I'm using the right scripting element, but I've tried it in a declaration and scriptlet.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65825
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get an error.


Don't you think it'd be a tad more useful to share the error message with us?
 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, my apologies...
Synatax:Unexpected input discarded
Lexical:Illegal Token
 
Daniil Sosonkin
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't format be enclosed into quotes ("):

DecimalFormat df = new DecimalFormat("###,###");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!