前台android后台spring+springmvc+hibernate
这是本人在公司开发自己搭建的一套环境,开发简单,模块性强。易于移植。所以今天闲的没事来个简单的介绍。
广告:由于我的博文《docker实现离线地图server》怎么写都搜不到,所以请原谅我这样无耻的推广~~:https://blog.csdn.net/u010403700/article/details/90678645
一:用到的技术
Android:android4.4、LoonAndroid、ormlite-android-4.49、fastjson-1.1.29、hellocharts-library-1.5.8、baidumap api、open_sdk_r5509(qq分享)、open_sdk_r5509(微信分享)、mta-sdk-1.6.2
Java:springmvc、hibernate、maven等。
二:演示介绍
Demo show:
(轮番页) (登录页) (首页)
App1 show
三:代码目录介绍
三部门代码书写介绍:
Android:
定义变量:
1.@InjectView
EditText user_name;
2.@TextRule(minLength = 1, trim = true, message = "密码不能为空",order = 2)
@InjectView
EditText user_password;
3. @InjectView(binders = { @InjectBinder(method = "click",listeners = { OnClick.class }) })
View button_login;
4.@InjectAll
private Views v;
class Views {
TextView frameTitle;
LinearLayout listLinear, titleView;
}
操作数据库
new SysUsersDao(this).add(user); activity
public void add(SysUsers user) {
userDaoOpe.create(user); Dao
}
TableUtils.createTable(connectionSource, SysUsers.class); 创建表
TableUtils.dropTable(connectionSource, SysUsers.class, true); 删除表
手机端请求数据(模块型)
NetUtil.ajax(URL.sys_drtj, null, new AppCallBack() {
@Override
public voidsuccess(ResponseEntity entity, PhoneEntity pe) {
JSONArray riObj= (JSONArray) pe.getDataList().get(0);
}
@Override
public voiderror(ResponseEntity entity, PhoneEntity phoneEntity) {
}
});
Java
后台返回数据
@RequestMapping(value = "/login")
public void login(HttpServletRequestrequest, HttpServletResponse response, HttpSession session, String user_name,
Stringpassword) {
SysUserssysUser = sysUsersService.phoneUserLogin(user_name, password);
ArrayList
dataList.add(sysUser);
ResponseUtil.printl(response,ResponseUtil.getPhoneEntityJson(PhoneEntity.getInstnet(dataList)),"json");
}
数据库配置
jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=EPT_ManageDb
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
jdbc.username=sa
jdbc.password=1
model配置
@Entity
@Table(name = "Sys_Users")
public class SysUsers extends CommonEntityimplements Serializable {
privatestatic final long serialVersionUID = 1L;
@Id
@Column(name= "KeyId")
privateString keyId;
@AccessType(value= "property")
@Column(name= "userName")
privateString userName;
@AccessType(value= "property")
@Column(name= "password")
我一直用这套东西写android 感觉挺不错的。呵呵。想要q米(914423503) 收费的啦