在servlet中获取页面传递过来的数据的方式是:request.getParameter(“username”);这个代码可以获取到页面的username的数据。在action中可以通过属性驱动的方式来获取页面的值。
例子:
jsp请求页面
<form action="propertydriver/propertyDriverAction_testPropertyDriver.action" method="post">
    	用户名:<input type="text" name="username"/>
    	密码:<input type="password" name="password"/>
		<input type="submit"/>
    </form>
Action内容
public class PropertyDriverAction extends ActionSupport{
	private String username;
	private String password;
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String testPropertyDriver(){
		System.out.println(this.username);
		System.out.println(this.password);
		return SUCCESS;
	}
}
 * 属性驱动的执行过程:
 * 		在页面上提交了一个url,这个url将被ParametersInterceptor拦截,这个拦截器的功能是
 * 		获取页面上的表单中的值
 * 		
 * 		因为这个时候,action已经在对象栈中,所以action中的属性就在栈中,所以可以给栈中的属性赋值
说明:
1、 页面中name的属性和action中的属性必须保持一致。
2、 Action中的属性必须有get和set方法。
3、 满足这两个条件就实现了属性驱动。
原文:http://www.cnblogs.com/callyblog/p/7544944.html