html:select(html:optioin)值绑定问题.各位高手帮帮忙
时间:2011-09-08
来源:互联网
不知道为什么,页面不走action出来的是空的select下拉列表框,他的值我是从数据库中读出来的,可是就是绑定不上去。
<html:form action="/epets" method="post">
<html:hidden property="operate" value="toList"/>
<html:select property="user.id">
<html:optionsCollection property="qxList" label="name" value="id" />
</html:select>
</html:form>
这是我的页面代码。
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EpetsForm epetsForm = (EpetsForm) form;
List list=biz.userAdders();
epetsForm.setQxList(list);
request.setAttribute("qxList",epetsForm.getQxList());
return mapping.findForward("regsiter");
}
这是action代码。
public class EpetsForm extends ActionForm {
private List qxList = new ArrayList();
public User user=new User();
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public List getQxList() {
return qxList;
}
public void setQxList(List qxList) {
this.qxList = qxList;
}
}
这是form代码。
<struts-config>
<data-sources />
<form-beans >
<form-bean name="epetsForm" type="com.aptech.jb.epet.web.form.EpetsForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="epetsForm"
input="/regsiter.jsp"
name="epetsForm"
path="/epets"
scope="request"
type="com.aptech.jb.epet.web.action.EpetsAction" parameter="operate">
<forward name="regsiter" path="/regsiter.jsp" />
</action>
</action-mappings>
<message-resources parameter="com.apetech.jb.epet.ApplicationResources" />
</struts-config>
这是配置文件
<html:form action="/epets" method="post">
<html:hidden property="operate" value="toList"/>
<html:select property="user.id">
<html:optionsCollection property="qxList" label="name" value="id" />
</html:select>
</html:form>
这是我的页面代码。
public ActionForward toList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EpetsForm epetsForm = (EpetsForm) form;
List list=biz.userAdders();
epetsForm.setQxList(list);
request.setAttribute("qxList",epetsForm.getQxList());
return mapping.findForward("regsiter");
}
这是action代码。
public class EpetsForm extends ActionForm {
private List qxList = new ArrayList();
public User user=new User();
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public List getQxList() {
return qxList;
}
public void setQxList(List qxList) {
this.qxList = qxList;
}
}
这是form代码。
<struts-config>
<data-sources />
<form-beans >
<form-bean name="epetsForm" type="com.aptech.jb.epet.web.form.EpetsForm" />
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings >
<action
attribute="epetsForm"
input="/regsiter.jsp"
name="epetsForm"
path="/epets"
scope="request"
type="com.aptech.jb.epet.web.action.EpetsAction" parameter="operate">
<forward name="regsiter" path="/regsiter.jsp" />
</action>
</action-mappings>
<message-resources parameter="com.apetech.jb.epet.ApplicationResources" />
</struts-config>
这是配置文件
作者: wins1 发布时间: 2011-09-08
有什么错误信息吗
调试一下
调试一下
作者: wangquanzheng 发布时间: 2011-09-08
根本就不进action,也没有什么错误信息,郁闷啊!
作者: wins1 发布时间: 2011-09-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28