I want to make an interceptor to pre-process XML request. In this interceptor, it parse the XML and put the processed info into ValueStack so that it can map to the instance in the action. However, I have tried so many methods but none of them is work. Can anyone help me and give me advises? Thanks!
In Interceptor
//Get ValueStack
ActionContext ctx = invocation.getInvocationContext();
Map ctxMap = ctx.getValueStack().getContext();//Have tried the following but none of the following is work
ctxMap.get("com.opensymphony.xwork2.ActionContext.parameters")).put("data1", "1");
ctxMap.get("parameters")).put("data1", "1");
ctxMap.get("request")).put("data1", "1");
ctx.getParameters().put("data1",new String[]{"1"});
//Sample Action Class
public class TestAction extends ActionSupport {
private String data1;
public String execute() {
System.out.println("data1 value: " + data1);
return SUCCESS;
}
//Get Setter is omitted here
}