I have a very simple action class with one member variable "data". when I submit the normal url it shows value in tomcat console like:Test action data=hello
public class ActionTest extends ActionSupport {
private static final long serialVersionUID = -2606731098320589210L;
private String data;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Action(value = "mytestaction")
public String execute() {
System.out.println("Test action data="+data);
return SUCCESS;
}
}
If I use debug mode like modifying url with mytestaction.action?data=hello&debug=browser
in tomcat console it shows Test action data=null
. But it shows the value in browser ognl context tree in parameters. However the same data
is null when Action class is expanded.
In other debug mode like debug=xml it comes as
<actionErrors />
<actionMessages />
<class>class com.ycs.fe.actions.ActionTest</class>
<data>hello</data>
<errorMessages />
<errors />
<fieldErrors />
and in debug=console mode if i print the OGNL #action.data =>shows hello
also #parameters.data[0] => shows hello
.
Is this a genuine bug? or am i missing something? I tried with convention as well as mapping in struts.xml, but both have开发者_如何学编程 same result.
精彩评论