通过map给action传参数的问题
做了一个登陆页面,安卓页面用
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId", username);
params.put("userPassword", password);
传递参数,用户数据接口用的action接受参数。
@Action("/data/login")
public String login() throws SystemException, DatabaseException {
session.clear();
ActionContext context=ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)context.get(ServletActionContext.HTTP_REQUEST);
Map<String,String[]> paramMap = request.getParameterMap();
for(Map.Entry<String,String[]> entry:paramMap.entrySet()){
String key = entry.getKey();
String[] value = entry.getValue();
System.out.println(key + " : " + value[0]);
}
}
为啥死活接收不到传递过来的map参数?都是null。写了一个测试jsp页面,都能接收到参数。