gwt ext Á¬½ÓMySqlÊý¾Ý¿â
¸ÃÁ¬½Ó·½Ê½²ÉÓÃRPCÀ´·µ»ØÊý¾Ý¿â²éѯ½á¹û¡£
1.Ê×ÏÈÊÇ´´½¨ÆÕͨµÄGWT-EXT¹¤³Ì¡£¿ÉÒԲο¼1http://www.ibm.com/developerworks/cn/java/j-lo-gwtext1/#resources
ϵÁÐ Èë ÃÅ ½Ì³Ì¡£¾ßÌåͨѶ¹ý³Ì·þÎñÒ²¿É²Î¿¼ÉÏÊöµÄ×îºó²¿·Ö˵Ã÷¡£
2. ½ÓÏÂÀ´¾ÍÊÇÒª´´½¨GWT Remote ServiceÁË£¬ÔÚÔÓй¤³ÌÉÏnew->Other->GWT Remote Service ¡£Èçͼ1£º
ͼ1
н¨Ò»¸öGWT Remote ServiceÈçÏÂͼ2£º
ͼ2
Íê³ÉÊäÈëÈ·¶¨ºó£¬GWT»á×Ô¶¯ÔÚclent¶ËºÍserver¶ËÉú³ÉÐèÒªµÄÎļþ¡£ÈçÏÂͼ3ÒõÓ°²¿·ÖÎļþ£º
3.Íê³ÉÁË»ù±¾ÅäÖúó£¬ÎÒÃÇҪдÐèҪʵÏֵĴúÂ룻
±¾ÈËÊý¾Ý¿âΪstudent;ΪÁ˼òµ¥Ö»ÓÐ3ÁУ¬sno,name,sexÈýÏî¡£
a.ÔÚDbServiceÀïʵÏÖgetInstance()£¬ÊµÏÖͨѶ¹¦ÄÜ¡£¾ßÌå¼û²Î¿¼1.
´úÂëÈçÏ£º
package zjm.DbBase.demo.client;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
@RemoteServiceRelativePath("DbService")
public interface DbService extends RemoteService {
public List<DTO> loadData()throws Exception;
public static final String SERVICE_URI = "DbService";
public static class Util {
public static DbServiceAsync getInstance() {
DbServiceAsync instance = (DbServiceAsync) GWT
.create(DbService.class);
ServiceDefTarget target = (ServiceDefTarget) instance;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + SERVICE_URI);
return instance;
}
}
}
ÆäÖÐpublic List<DTO> ·½·¨ÊÇ×Ô¼º¶¨ÒåÀ´»ñÈ¡Êý¾Ý¿âÊý¾ÝµÄ·½·¨¡£Õâ¸ö·½·¨ÐèÒªÔÚDbServiceImpl.javaÖÐʵÏÖ¡£¸ÃÀàʵÏÖÁËDbServiceÕâ¸ö·þÎñ½Ó¿Ú¡£
b. DbServiceImpl.java´úÂëʵÏÖÉÏÊö·½·¨£º
´úÂ룺
package zjm.DbBase.demo.server;
import java.sql.DriverManager;
import java.util.LinkedList;
import java.util.List;
import zjm.DbBase.demo.client.DTO;
import zjm.DbBase.demo.client.DbService;
i
Ïà¹ØÎĵµ£º
mysql ´´½¨±í£º
mysql> create table user(
-> userid int(4) primary key not null auto_increment,
-> username varchar(16) not null,
-> userpassword varchar(32) not null
-> );
create table log(
logid int(4) ......
¹Ù·½ÊÖ²áÉÏÊÇÕâôдµÄ£º
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{f ......
1.SELECT
*
from
table
LIMIT
1
,
20
;
//
¼ìË÷¼Ç¼ÐÐ
2-21
µÚÒ»¸ö²ÎÊý£º²éѯÆðʼÐУ¨´Ó0¿ªÊ¼£©
µÚ¶þ¸ö²ÎÊý£º²éѯ¼¸Ìõ¼Ç¼
2.
SELECT
*
from
table
LIMIT
5
,
-
1
;
//
&nbs ......
¾Ý¹úÍâýÌ屨µÀ£¬MySQLÊý¾Ý¿âµÄ¿ª·¢ÕßMichael WideniusÒÔ¼°²¿·ÖÏà¹ØÈËÊ¿½üÈÕÏòÅ·ÖÞ¡¢ÖйúÓë¶íÂÞ˹µÄ¼à¹Ü»ú¹¹Ìá½»Á˶Լ׹ÇÎÄ-Sun½»Ò׵ķ´¶ÔÒâ¼û£¬ÓдóÔ¼14000ÈËÔÚ¸ÃÒâ¼ûÉÏÇ©×Ö±íʾËûÃǶԴËÊÕ¹ºµÄ·´¶Ô¡£Å·ÃËίԱ»á´ËÇ°Ôø·´¶Ô¼×¹ÇÎÄÊÕ¹ºSun£¬µ«Õâһ¢¶ÏÉó²é»ú¹¹ÔÚ12ÔÂÓֳƣ¬¶Ô´Ë½»Ò×´ï³ÉÒ»¸öÂúÒâµÄ½á¹û±íʾÀÖ¹Û¡£Å·ÃËίԱ»á½«Ô ......