J2ME Form Nesneleri Melih Sakarya
Connection HttpConnectionInputConnectionOutputConnectionDatagramConnectionStreamConnection Socket Connection lari Web Servisleri
HttpConnection HtppConnection conn=(HtppConnection )Connector.open(URL);
HttpConnection conn.setRequestMethod(HttpConnection.GET); conn.setRequestProperty("IF-Modified-Since", "10 Nov :29:12 GMT"); conn.setRequestProperty("User-Agent","Profile/MIDP-1.0 Confirguration/CLDC-1.0"); conn.setRequestProperty("Content-Language", "en-CA");
HttpConnection HtppConnection conn=(HtppConnection )Connector.open(URL); InputStream is=conn.openInputStream(); int ch; while ((ch=is.read())!=-1) { buffer.append((char)ch);}is.close();conn.close(); String sonuc = buffer.toString();
StreamConnection StreamConnection conn=(StreamConnection )Connector.open(URL);
StreamConnection InputStream is=conn.openInputStream(); int ch; while ((ch=is.read())!=-1) { buffer.append((char)ch);}is.close();conn.close(); String sonuc = buffer.toString();
Sunucu Tarafi <% out.println(“Ekrana Bas”); %>
Tomcat Kurulumu
Sunucu Tarafli Sorgulama String URL=“ HtppConnection conn=(HtppConnection )Connector.open(URL); InputStream is=conn.openInputStream(); int ch; while ((ch=is.read())!=-1) { buffer.append((char)ch);}is.close();conn.close(); String sonuc = buffer.toString();
Sunucu Tarafi <% String okulNo=“”+request.getParameter(“okulNo”); if(okulNo.equals(“111”)){ out.println(“Selam Melih”); }%>
Veritabanindan Sorgulama <% String connectionURL = "jdbc:mysql://localhost:3306/mydatabase?user=username;password=password" ; Connection connection = null; Statement statement = null; ResultSet rs = null; %><%Class.forName("org.gjt.mm.mysql.Driver").newInstance(); connection = DriverManager.getConnection(connectionURL, "", ""); statement = connection.createStatement(); rs = statement.executeQuery("SELECT * FROM ogrenciler"); while (rs.next()) { out.println(rs.getString(“ad")+” ”+rs.getString(“ad")+“\n"); }rs.close();%>
Belli Araliklarla Baglanma TimerTask task=new TimerTask(){ public void run(){ veriGetir();}}; Timer timer=new Timer(); timer.schedule(task,new Date(),1000); Form form=new Form(""); ticker=new Ticker(""); form.setTicker(ticker);
Sunucu Tarafindan Resim Getirme HttpConnection conn=(HttpConnection)Connector.open(URL); InputStream is=conn.openInputStream(); DataInputStream din=new DataInputStream(is); int length=(int)conn.getLength(); byte[] data = new byte[length]; din.readFully( data ); is.close();din.close(); Image image=Image.createImage(data,0,data.length);
SORULAR ???