Servlet side
public class data {
private String id;
private String name;
public data(String id, String name) {
this.id=id;
this.name = name;
} // constructor
ArrayList<Object>list=new ArrayList<>();
list.add(new data("1", "aiueo"));
list.add(new data("2", "kakikukeko"));
list.add(new data("3", "sasisuseo"));
session.put("data",data);
//jsp side
<s:property value="session.data"/>//Unable to retrieve.
<s:property value="session.data">
<s:property value="id"/>
<s:property value="name"/>
</s:property>// This also causes errors
<s:property>
How do I retrieve it using the tag
I would like to write it in EL expression.If so,
<s:property value="${session.data}"/>
Or simply skip session
and
<s:property value="${data}"/>
How about
# This method will produce the same result as ArrayList.toString()
.
Therefore, you must override the class data
method toString
to string the value of the member variable.
© 2024 OneMinuteCode. All rights reserved.