struts 2 获取不到后台数据库的值
想要在前台显示存入数据库的个人信息,people属性有name,age,sex,educationsex和education单独设置了javabean前台jsp页面:<s...
想要在前台显示存入数据库的个人信息,people属性有name,age,sex,education
sex和education单独设置了java bean
前台jsp页面:
<s:iterator value="peoplelist" var="p">
<s:property value="#p.name"/> |
<s:property value="#p.age"/> |
<s:property value="#p.sex.value"/>|
<s:property value="#p.education.value"/>|
<a href="/T_Manager/People_delete?id=<s:property value="#p.id"/>">删除people</a> |
<a href="/T_Manager/People_updateInput?id=<s:property value="#p.id"/>">更新people</a>
<br/>
</s:iterator>
java bean:
public class Education {
private String Key;
private String value;
public String getKey() {
return Key;
}
public void setKey(String key) {
Key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Education(){}
public Education(String key, String value) {
super();
Key = key;
this.value = value;
}
}
public class EducationService {
public Education[] getEducation(){
return new Education[]{
new Education("1","小学"),
new Education("2","中学"),
new Education("3","高中"),
new Education("4","大学"),
new Education("5","研究生"),
new Education("5","硕士"),
new Education("5","博士")
};
}
}
可是,前台获取不到sex和education的信息。。哪里有问题? 展开
sex和education单独设置了java bean
前台jsp页面:
<s:iterator value="peoplelist" var="p">
<s:property value="#p.name"/> |
<s:property value="#p.age"/> |
<s:property value="#p.sex.value"/>|
<s:property value="#p.education.value"/>|
<a href="/T_Manager/People_delete?id=<s:property value="#p.id"/>">删除people</a> |
<a href="/T_Manager/People_updateInput?id=<s:property value="#p.id"/>">更新people</a>
<br/>
</s:iterator>
java bean:
public class Education {
private String Key;
private String value;
public String getKey() {
return Key;
}
public void setKey(String key) {
Key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Education(){}
public Education(String key, String value) {
super();
Key = key;
this.value = value;
}
}
public class EducationService {
public Education[] getEducation(){
return new Education[]{
new Education("1","小学"),
new Education("2","中学"),
new Education("3","高中"),
new Education("4","大学"),
new Education("5","研究生"),
new Education("5","硕士"),
new Education("5","博士")
};
}
}
可是,前台获取不到sex和education的信息。。哪里有问题? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询