Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.NumberFormatException: For input string: ""

843810Feb 18 2006 — edited Sep 18 2007
Hi.
I am new to this forum.I have not so much idea in java swing.I am doing an application in java swing.I used a JTextField.In side a loop I have written as below

if(!(txt_pageNo.getText() == ""))
{

System.out.println("coming in textfield..... 998");
if((Integer.parseInt(txt_pageNo.getText()) > commTotPage) || Integer.parseInt(txt_pageNo.getText()) <= 0)
{

}else
if((Integer.parseInt(txt_pageNo.getText()) != currentCommPage))
{
commTableDisplayOptionNo = 0;
currentCommPage = Integer.parseInt(txt_pageNo.getText());
comTabDispName = "MyVaayooPoker Communities" ;
Thread tt = new Thread()
{
public void run()
{
try
{
displayContrrol = 1;
String request = "reqid=01,appid=smruti,alphabet=all,commBulkNo="+currentCommPage;
httpTest.sendRequest(request);
//System.out.println("controller will come here");
}
catch(Exception e)
{
System.out.println("in sending requsst2..");
}
}
};

tt.start();
}

I have set initial text = " ";
When I left the field blank it still enters in side the if(!(txt_pageNo.getText() == "")) and giving me java.lang.NumberFormatException: For input string: "" error.
Thanks.
Srikant
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2007
Added on Feb 18 2006
3 comments
498 views