Java Web编程经验(华迪实习)

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



-------------------------------------------------------





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值