如何将 JavaBean 对象作为参数传递给操作?
例如我有动作(dataBean 是一个 JavaBean):
1)
public class SimpleAction extends ActionSupport {
private static final long serialVersionUID = 1L;
private DataBean dataBean;
public String execute() throws Exception {
System.out.println("SimpleAction executing");
System.out.println(dataBean.getMinDate().toString());
return SUCCESS;
}
public DataBean getDataBean() {
return dataBean;
}
public void setDataBean(DataBean dataBean) {
this.dataBean = dataBean;
}
2)然后我想用非字符串参数(dataBean)从jsp调用这个动作:
例如:
<s:url var="simple" action="simple">
<s:param name = "dataBean" value="#request.dataBean"/>
</s:url>
3) 我是否需要将类型从 dataBean 对象转换为字符串,反之亦然?
4) 是否可以在 Struts2 中使用这种结构?
5)请解释一下,代码示例也很好