public void add() {
System.out.println(person.getName()+"***********************************");
//personService.add(person);
}//调用Action不想跳转则返回 值设为void
-----------------------------------------------------------------
form中没有加method="post",也会乱码
--------------------------------------------------------------jsp传到action中乱码
jsonPerson=new String(jsonPerson.getBytes("ISO-8859-1"), "UTF-8");
---------------------------------------------------------------------
public int save(Person transientInstance) {
log.debug("saving Person instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
return transientInstance.getId();//返回系统自动生成的id
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
--------------------------------------------------------------
GsonBuilder gb = new GsonBuilder();
gb.setDateFormat("yyyy-MM-dd");//日期格式和json字符串不匹配,json字符串的属性若没有则置为null
Gson gson = gb.create();
---------------------------------------------------------------------
ApplicationContext ctx =new ClassPathXmlApplicationContext("applicationContext.xml");
PersonService ps = (PersonService)ctx.getBean("personService");
JSONArray json_personList = new JSONArray(ps.list(), false);
System.out.println(json_personList.toString());
//显示除了personApply这张表的信息,只要有personId,Hibernate就回去关联
----------------------------------------------------------------------
数据库表如果是一对一的关系,那么可以写在同一个form
但如果是一对多,要写在同一个form,那么就要考虑vo对象了
----------------------------------------------------------------
<action name="*-*" class="{1}Action" method="{2}">
<result name ="success" type="redirectAction">groupinfo_manage</result>
</action>
从一个Action的Result跳到另一个Action
-------------------------------------------------------