Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 21st, 2004, 11:34 PM
Joey2 Joey2 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 Joey2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help in solving errors..urgent

Hi,
i need help in solving this J2ME login program of my. I have 8 errors saying "Cannot resolve symbol" Can someone please help me? Thanks..it's urgent..

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

import javax.microedition.io.Connector;

import javax.microedition.io.HttpConnection;

import javax.microedition.io.StreamConnection;

import java.io.DataInputStream;

import java.io.DataOutputStream;

import java.io.InputStream;

import java.io.IOException;

import java.io.OutputStream;





publicclass LoginForm extends javax.microedition.midlet.MIDlet implements CommandListener

{

Display display;

boolean commandAvailable;

String idPassword;

CommandThread commandThread;





Form inputForm;

Form outputForm;



TextField userid;

TextField password;

Form counterForm;

StringItem response;

Command cmdExit;

Command cmdOK;





publicvoid startApp()

{

display = Display.getDisplay(
this);



inputForm =
new Form(null);

userid =
new TextField("User",null,25,TextField.ANY);

inputForm.append(userid);

password =
new TextField("Password",null,15,TextField.PASSWORD);

inputForm.append(password);



cmdOK =
new Command("OK",Command.SCREEN,1);

cmdExit =
new Command("Exit",Command.EXIT,1);

inputForm.addCommand(cmdOK);

inputForm.addCommand(cmdExit);

inputForm.setCommandListener(
this);



outputForm =
new Form(null);



response =
new StringItem(null,null);

outputForm.append(response);

outputForm.addCommand(cmdExit);

outputForm.setCommandListener(
this);



commandAvailable =
false;

commandThread =
new CommandThread(this);

commandThread.start();

display.setCurrent(inputForm);



}

publicvoid pauseApp()

{

}

publicvoid destroyApp(boolean unconditional)

{

}

publicvoid commandAction(Command cmd, Displayable d)

{

if (cmd == cmdExit)

{

destroyApp(
false);

notifyDestroyed();

}

elseif (cmd == cmdOK)

synchronized(this)

{



commandAvailable =
true;

notify();

}

}

}



class CommandThread extends Thread

{

MIDlet parent;



boolean exit = false;

public CommandThread(MIDlet parent)

{

this.parent = parent;

}



publicvoid run()

{

while (true)

{

synchronized(parent)

{

while(!commandAvailable)

{

try

{

parent.wait();

}

catch (InterruptedException e)

{

}

}

commandAvailable =
false;

}

performLogin();

}

}

publicvoid performLogin()

{

HttpConnection conn =
null;

InputStream is =
null;

OutputStream os =
null;

byte[] receivedData = null;

try

{

String url = "http://172.17.171.133/XYZ_Technologies?user=shaun&password=bogekko";

conn = (HttpConnection)Connector.open(url);

conn.setRequestMethod(HttpConnection.POST);

conn.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0");

conn.setRequestProperty("Content-type","application/x-www-form-urlencoded");

byte[] postData = createPostData();

os = conn.openOutputStream();

os.write(postData);

is = conn.openInputStream();

String contentType = conn.getType();

int len = (int) conn.getLength();

if (len > 0)

{

receivedData =
newbyte[len];

int nb = is.read(receivedData);

}

else

{

receivedData =
newbyte[1024];

int ch;

len = 0;

while ((ch = is.read()) != -1)

{

receivedData[len++] = (
byte) ch;

}

}

response.setText(
new String(receivedData,0,len));

display.setCurrent(outputForm);

}

catch (IOException e)

{

System.out.println(e.getMessage());

e.printStackTrace();

}

finally

{

try

{

if (is !=null)

{

is.close();

}

if (os !=null)

{

os.close();

}

if (conn !=null)

{

conn.close();

}

}

catch (IOException e)

{

}

}

}

publicbyte[] createPostData()

{

StringBuffer sb =
new StringBuffer();

sb.append("userid=");

sb.append(userid.getString());

sb.append("&password=");

sb.append(password.getString());



System.out.println("sb = <" + sb.toString() + ">");

}

}


















Reply With Quote
  #2  
Old April 22nd, 2004, 07:15 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
What, no line numbers in the error messages and no markers in the code pointing to line numbers? Can't do much with this, I'm afraid.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Need help in solving errors..urgent


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT