用 s:select 试试:
<s:select name="user.sex" list="#{'0':'男','1':'女'}" label="性别" headerKey="" headerValue="请选择性别"></s:select>
<s:select name="user.sex" list="#{'0':'男','1':'女'}" label="性别" headerKey="" headerValue="请选择性别"></s:select>
public ActionForward add(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Info med = null;
InfoForm df = (InfoForm) form;
InfoDao dao = new InfoDao();
med = new Info();
BeanUtils.copyProperties(med, df);
CategoryDao cd = new CategoryDao();
List list = cd.findByHQL("from Category");
request.setAttribute("cs", list);
Category category = cd.loadCategory(df.getCategoryId());
med.setCategory(category);
dao.saveOrUpdate(med);
return mapping.findForward("addSuccess");
}
jsp页面引用如下:
<%@ page import="com.lyq.struts.action.InfoAction" %>
不知哪里有问题?
楼上已经给出答案了 你这样写 页面代码不美观