I use struts2 <s:bean>,like follows:
---SimpleCounter---
package test;
public class SimpleCounter{
String foo;
public void setFoo(String foo){
System.out.println("set foo="+foo);
this.foo=foo;
}
public String getFoo(){
System.out.println("get foo="+foo);
return foo;
}
}
---test.jsp---
<%@(protected)" %>
<s:bean name="test.SimpleCounter" id="counter">
<s:param name="foo" value="BAR" />
The value of foot is : <s:property value="foo"/>, when inside the bean
tag <br />
</s:bean>
When I run it,tomcat shows:
set foo=null
get foo=null
IE shows:
The value of foot is : , when inside the bean tag
I think <s:param name="foo" value="BAR" /> should call setFoo("BAR") and
should print set foo=BAR,I don't know why print set foo=null. Anyone can
tell me the reason of error.
Thanks