java - Struts 2 property tag can't access abstract parent class member -
i'm having problems accessing property via struts. wondering if who's more experienced struts able give me few pointers.
the java classes set this:
public abstract class parent{ protected integer id; public integer getid(){ return this.id; } } public class child extends parent{ // stuff }
the child list in action class getter set up:
private list<child> childlist;
this code in front end, attempting grab id
property:
<s:iterator value="childlist" status="cstatus"> <s:property value='id' /> </s:iterator>
however, nothing shows up. i've grabbed other members child class, i'm assuming there's issue parent member i'm grabbing being in abstract class?
update
i've attempted grab property in abstract class in jsp
, works fine. other property grabbed creationdate
. i've added breakpoints id
getter , it's being accessed fine , returning non-null values. here more detailed implementation of parent hibernate
annotations included:
@mappedsuperclass public abstract class parent{ protected integer id; protected date creationdate; @id @generatedvalue(strategy=generationtype.identity) @documentid public integer getid() { return this.id; } protected void setid(integer id) { this.id = id; } @column(updatable=false, nullable=false) @temporal(temporaltype.timestamp) public date getcreationdate() { return this.creationdate; } @suppresswarnings("unused") private void setcreationdate(date creationdate) { this.creationdate = creationdate; } }
the problem in
private list<child> childlist;
it requires
private list<child> childlist = new arraylist<>(); public list<child> getchildlist(){ return childlist; }
in jsp
<s:iterator value="childlist" status="cstatus"> <s:property value="id" /> </s:iterator>
Comments
Post a Comment