第十三部分附件_Preparable

package com.test.action;



import com.opensymphony.xwork2.ActionSupport;

import com.opensymphony.xwork2.ModelDriven;

import com.opensymphony.xwork2.Preparable;

import com.test.bean.User;



public class RegisterAction2 extends ActionSupport implements ModelDriven<User>, Preparable

{

	private User user = new User();

	

	public User getModel()

	{

		return user;

	}

	

	public void prepare() throws Exception // 在execute执行之前被调用,不要和业务逻辑相关联,可以做任何前期的你想做的准备工作

	{

		System.out.println("prepare");

	}

	

	@Override

	public String execute() throws Exception

	{

		System.out.println("execute");

		return SUCCESS;

	}

}

  

你可能感兴趣的:(pre)