I will send you the three programs please tell me correct way in the progarms data1 data are the
jsp programs in which i wrote databse conenction
LoginMidlet
package MIDlets;
import java.io.*;
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
public class LoginMidlet extends MIDlet implements CommandListener
{
private Display display;
private TextField userName;
private TextField password;
private Form form;
private Command cancel;
private Command login;
private Validate objMenu;
public LoginMidlet() throws Exception
{
userName = new TextField("LoginID:", "", 10, TextField.ANY);
password = new TextField("Password:", "", 10, TextField.PASSWORD);
form = new Form("Sign in");
cancel = new Command("Cancel", Command.CANCEL, 2);
login = new Command("Login", Command.OK, 2);
}
public void startApp()
{
display = Display.getDisplay(this);
form.append(userName);
form.append(password);
form.addCommand(cancel);
form.addCommand(login);
form.setCommandListener(this);
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
public void validateUser(
String Password)
{
objMenu = new Validate();
if(password.equals("ProvPassword"))
{
objMenu.menu(display);
} else {
tryAgain();
}
}
public void tryAgain() {
Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR);
error.setTimeout(Alert.FOREVER);
userName.setString("");
password.setString("");
display.setCurrent(error, form);
}
public void commandAction(Command c, Displayable d) {
String label = c.getLabel();
if(label.equals("Cancel")) {
destroyApp(true);
} else if(label.equals("Login")) {
validateUser(password.getString());
}
}
}
Valiadte package MIDlets;
import java.io.*;
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
public class Validate extends MIDlet implements CommandListener {
private complaint objcomplaintRequest;
Display display;
private String getURL="http://localhost/jspprograms/data.jsp?userName=ProvID&password=ProvPassword";
public void menu(Display display) {
this.display=display;
List services = new List("Choose one", Choice.EXCLUSIVE);
services.append("Your request/Response", null);
services.append("Sign Out", null);
services.setCommandListener(this);
display.setCurrent(services);
}
public void startApp()
{
try {
HttpConnection conn = (HttpConnection) Connector.open(getURL);
conn.setRequestMethod(HttpConnection.POST);
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
objcomplaintRequest=new complaint();
String label = c.getLabel();
if(label.equals("Your request/Response")) {
objcomplaintRequest.complaint();
} else if(label.equals("Sign Out")) {
destroyApp(true);
}
}
}
compalint
package MIDlets;
import java.io.*;
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
class complaint
{
private String getURL="http://localhost/jspprograms/data1.jsp";
public void startApp() {
try {
HttpConnection conn = (HttpConnection) Connector.open(getURL);
conn.setRequestMethod(HttpConnection.POST);
conn.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
one error is comingProject "LoginMidlet" loaded
Settings updated
Project settings saved
Project settings saved
Building "LoginMidlet"
C:\WTK25\apps\LoginMidlet\src\Validate.java:52: cannot find symbol
symbol : method complaint()
location: class MIDlets.complaint
objcomplaintRequest.complaint();
^
1 error
com.sun.kvem.ktools.ExecutionException
Build failed