1. Method to convert json string into Java object and Java object array
public static void main(String[] args) { User_DAL userDal = new User_DAL();// 创建数据访问对象 ResponseResult<User> ret = userDal.getUserList("id < 50", 2, 10);// 查询ID小于50的用户,保存到分页类中 String json = JSON.toJSONString(ret, true); // 将对象转换成json字符串,true为格式化输出 System.out.println(json); List<User> list = JSON.parseArray("{{name:123},{name:456}}", User.class);//将json字符串,转换成Java对象数组 for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i).getName()); } }
#2.jQueryAdd attributeDelete attribute
jQuery( $("#id").attr(" readonly ":"readonly"); //添加readonly属性 & $("#ID").attr({ readonly: 'true' }); $("#id").removeAttr("readonly"); //去除readonly属性 );
3. When the form is submitted, there are objects and parameters.
Encapsulate the required objects first
#ajax passes data
Java background processing: fastJson converts json string into Java object
#No more errors will be reported when reloading the page.
##Place the following code in your CSS file That’s it:
.break-word { word-wrap: break-word; break-word: break-all; }6. Automatically refresh the page to prevent session failure
7. How to use the INSERT INTO SELECT FROM statement with specific examples
insert into table_a select * from table_b 如果两表字段不同,a表需要b中的某几个字段即可,则可以如下使用: insert into table_a(field_a1,field_a2,field_a3) select field_b1,field_b2,field_b3) from table_b 以上语句前提条件是每个字段对应的字段类型相同或可以自动转换。
The above is the detailed content of Summary and sharing of small details in the javaWeb development process (2). For more information, please follow other related articles on the PHP Chinese website!