Author: Guan Wenbai Time: May 26, 2005
Currently, many technologies are available for the Internet of j2_mdb. I have just come into contact with this technology. In the past few days, I have helped others debug some programs in this field and learned a lot. Next I will talk about my learning process.
First, this program can be simply divided into three layers,
1. Client (MIDlet program)
2. Server-side servlet (servlet program)
3. Database (Access or SQL)
Below is a small example to send a request through the mobile client, and then the server servlet responds. The servlet returns the content of the Access database to the mobile client by querying the content of the Access database.
And displayed.
A simple task involves many steps.
Development Environment:
Operating system: windows 2000 professional
JDK Version: 1.4.2
WTK version: 2.1
Tomcat version: 5.0
If you still don't understand what jdk wtk tomcat is, I suggest you study the basics. I will not explain it here.
The JDK version must be 1.4.0 or later. You may use a lower version and be compatible with a lower version of Tomcat. However, if I try atat5.0 + JDK1.0.3, an error will be reported.
The Tomcat server cannot be started. In the Tomcat log, the "Unsuported JNI version 65537" is written in this way. Therefore, I use a relatively higher version of JDK.
Configure environment variables. Test your environment variables. In the cmd window, enter java-version to check the JDK version. Enter javac to check whether an error is reported. None
If an error occurs, the JDK environment variables are correctly set.
Then, we edit the client program of J2's, which consists of two classes. I am not a master, so the program can only achieve functions for the purpose, and does not reflect the value of optimization.
--------------------------------- NetMain. java -----------------------------------------------------
Import javax. microedition. midlet .*;
Import javax. microedition. lcdui .*;
Public class NetMain extends MIDlet implements CommandListener // inherit from the MIDlet to implement the CommandListener interface
{
Private Display dis;
SendMsg sm;
Private Command sd = new Command ("connection", Command. OK, 1); // send data Button
Public NetMain ()
{
Dis = Display. getDisplay (this); // get the Display object
}
Public void startApp ()
{
Form f = new Form ("networking test"); // Form object displayed on the screen
F. append ("Send data ");
F. addCommand (sd );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.