在StudentAction中实例化一个对象private Student studentInfo;public Student getStudentInfo() {
return studentInfo;
}public void setStudentInfo(Student studentInfo) {
this.studentInfo = studentInfo;
}
public String getStudent() throws Exception {
String id = ServletActionContext.getRequest().getParameter("id");Student student = new Student();
student.setId(Integer.parseInt(id));
Student studentInfo = (Student) studentbiz.getStudent(student);
ServletActionContext.getRequest().setAttribute("studentInfo", studentInfo);
return "showInfo";
}
在StudentInfo.jsp中用了三种方式显示都不能出来
<s:textfield name="studentInfo.name" value="#{name}"></s:textfield>
<s:textfield value="#studentInfo.name"></s:textfield>
<s:textfield value="<s:property value='#request.studentInfo.name'/>"></s:textfield>
请各位给力 ,多多支持!!
return studentInfo;
}public void setStudentInfo(Student studentInfo) {
this.studentInfo = studentInfo;
}
public String getStudent() throws Exception {
String id = ServletActionContext.getRequest().getParameter("id");Student student = new Student();
student.setId(Integer.parseInt(id));
Student studentInfo = (Student) studentbiz.getStudent(student);
ServletActionContext.getRequest().setAttribute("studentInfo", studentInfo);
return "showInfo";
}
在StudentInfo.jsp中用了三种方式显示都不能出来
<s:textfield name="studentInfo.name" value="#{name}"></s:textfield>
<s:textfield value="#studentInfo.name"></s:textfield>
<s:textfield value="<s:property value='#request.studentInfo.name'/>"></s:textfield>
请各位给力 ,多多支持!!
解决方案 »
- 找不到Action
- javascript在IE中不能运行,FF中能运行。
- JSP连接MySQL总是出错:No suitable driver
- 究竟那里错了!时间输入数据库!
- SOS!!!!有谁用jbuilder开发过jsp的吗??50分!
- 如何去处 字符串中的html标记
- 说服老板免费送100M邮箱给所有网民,散分
- 登录JSP页面时怎样设置权限?
- 为何“package javax.servlet does not exist”?
- tomcat + apache 启动问题
- Hyberbin java web 开源框架
- 开源:实时采集,实时索引,实时检索的视频搜索引擎正式开源,单机支持3000万网页的全文检索
<s:textfield name="studentInfo.name" ></s:textfield>
ServletActionContext.getRequest().setAttribute("studentInfo", studentInfo);你这等于是把studentInfo 放到request里了,没set,改成
this.studentInfo = (Student) studentbiz.getStudent(student);
修改为<s:textfield value="%{#studentInfo.name}"></s:textfield>
或者改为<s:textfield value="%{#request.name}"></s:textfield>
request传过来的值就可以了。。