spring mvc4.x怎么返回json格式

 我来答
千锋教育
2017-02-06 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
展开全部
public void onCreateA(SQLiteDatabase db) { System.out.println("On create works"); try { db.execSQL("DROP TABLE IF EXISTS actuator;"); db.execSQL("CREATE TABLE IF NOT EXISTS actuator ("+ "ACTUATOR_ID INT(11) NOT NULL,"+ "ACTUATOR_HW_ID int(11) DEFAULT NULL,"+ "DEVICE_NAME TEXT(45) DEFAULT NULL,"+ "DEVICE_TYPE TEXT(45) DEFAULT NULL,"+ "DEVICE_SUB_TYPE TEXT(45) DEFAULT NULL,"+ "LOCATION_ID INT(11) DEFAULT NULL,"+ "STATUES_VALUE REAL DEFAULT NULL,"+ "MAX_STATUES_VALUE REAL DEFAULT NULL,"+ "MIN_STATUES_VALUE REAL DEFAULT NULL,"+ "PRIMARY KEY (`ACTUATOR_ID`))"); System.out.println("table created now values will be added"); System.out.print("DONE!"); } catch (SQLException e) { System.out.println("table is not created"); } try { db.execSQL("INSERT INTO actuator (ACTUATOR_ID, ACTUATOR_HW_ID, DEVICE_NAME, DEVICE_TYPE, DEVICE_SUB_TYPE, LOCATION_ID, STATUES_VALUE, MAX_STATUES_VALUE, MIN_STATUES_VALUE) " + "VALUES (1, 2, 'Heat Sensor FX615','Heat Sensor', 'Optic ... public void onCreateA(SQLiteDatabase db) {

System.out.println("On create works");

try {
db.execSQL("DROP TABLE IF EXISTS actuator;");
db.execSQL("CREATE TABLE IF NOT EXISTS actuator ("+
"ACTUATOR_ID INT(11) NOT NULL,"+
"ACTUATOR_HW_ID int(11) DEFAULT NULL,"+
"DEVICE_NAME TEXT(45) DEFAULT NULL,"+
"DEVICE_TYPE TEXT(45) DEFAULT NULL,"+
"DEVICE_SUB_TYPE TEXT(45) DEFAULT NULL,"+
"LOCATION_ID INT(11) DEFAULT NULL,"+
"STATUES_VALUE REAL DEFAULT NULL,"+
"MAX_STATUES_VALUE REAL DEFAULT NULL,"+
"MIN_STATUES_VALUE REAL DEFAULT NULL,"+
"PRIMARY KEY (`ACTUATOR_ID`))");

System.out.println("table created now values will be added");

System.out.print("DONE!");

} catch (SQLException e) {

System.out.println("table is not created");
}

try {
db.execSQL("INSERT INTO actuator (ACTUATOR_ID, ACTUATOR_HW_ID, DEVICE_NAME, DEVICE_TYPE, DEVICE_SUB_TYPE, LOCATION_ID, STATUES_VALUE, MAX_STATUES_VALUE, MIN_STATUES_VALUE) " +
"VALUES (1, 2, 'Heat Sensor FX615','Heat Sensor', 'Optic Heat Sensor', 4, 6, 7, 8) " );
System.out.println("values are added");
} catch (Exception e) {

e.printStackTrace();
System.out.println("values are not added");
}

try {
db.execSQL("SELECT * FROM actuator");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("not selected");
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式