name are not displaying on jsp
private CustomerGroup customerGroup;
public CustomerGroup getCustomerGroup () {
return customerGroup;
}
public void setCustomerGroup (CustomerGroup customerGroup) {
this.customerGroup= customerGroup;
}
When I print customerGroup
it shows group name which is fine. System.out.println("Customer Group is "+customerRecord.getCustomerGroup().getGroupName());
But when I display on JSP it doesn't show the group name, it is show class name with package.
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:iterator value="list"开发者_如何转开发>
<s:property value="customerGroup"/>
</s:iterator>
Because on console you are explicitly printing the name using, System.out.println("Customer Group is "+customerRecord.getCustomerGroup().getGroupName());
And in JSP you are just printing the customerGroup
<s:property value="customerGroup"/>
Which is of course different.
Try this, instead
<s:property value="customerGroup.groupName"/>
I think you have a class like:
class CustomerGroup {
private String groupName;
public String getGroupName()
{
return groupName;
}
public void setGroupName(String str)
{
this.groupName = str;
}
}
and your list is List<CustomerGroup>
; so you can only use:
<s:property value="groupName"/>
hope helpful to you.
That is only specific to how you are trying to use OGNL.weather you are trying touse OGNL to refer to the CustomerGroup propery or if you want to access individual elemets
精彩评论