<action name="Locator" method="execute" class="LocatorAction">
<result name="success">/locator/StoreInfo.jsp</result>
</action>
I have a variable foo in LocatorAction class and I want to display it on my result jsp, how can I do this?
Your action should look similar to this:
public class LocatorAction extends ActionSupport {
private Foo foo;
public Foo getFoo() {
return foo;
}
public void setFoo(Foo foo) {
this.foo = foo;
}
}
and on the JSP:
<s:property value="foo" />
or if the object has fields like address, city, state, zip, etc:
<s:property value="foo.address" />
<s:property value="foo.city" />
<s:property value="foo.state" />
将变量的值设置为与所需视图绑定的表单字段之一,然后简单地显示它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.