File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes I have 3 midlets but code to be displayed should be in first midlet . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "I have 3 midlets but code to be displayed should be in first midlet . " Watch "I have 3 midlets but code to be displayed should be in first midlet . " New topic
Author

I have 3 midlets but code to be displayed should be in first midlet .

anu rani
Greenhorn

Joined: Aug 29, 2006
Posts: 14
I have 3 midlets but code to be displayed should be in first midlet . but in the emulator all the names of 3 midlets are being displayed how should code be to interlink the 3 midlets
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

If three are showing up, it's because you've put all three into the descriptor files. (Which is where, i believe, the implementation gets the names.) What are yo utrying to accomplish, so we might better help you?


Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
anu rani
Greenhorn

Joined: Aug 29, 2006
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I have 3 midlets but code to be displayed should be in first midlet .