是这样的:就是给一个用户付角色 ygjbxx的属性:ygxxbh,xm,yhbh、、、、、、、 xtyhb:yhbh,yhmc、、、、、、 yhjs:yhbh,jsbh、、、、、、 xtjsb:jsbh,jsxm、、、、、、 这是access类 public static List getJsxxs(String cond){ String sql="select D.jsbh,D.jsmc from ygjbxx A,xtyhb B,yhjs C,xtjsb D where A.ygxxbh=B.ygxxbh and B.yh=C.yh and C.jsbh=D.jsbh "+cond; System.out.println(sql); return Java_reflect.GetBeanList(sql,XtjsbActionForm.class);}public static List getYhjsxxs(int ygxxbh){ //String sql="select D.jsbh from ygjbxx A,xtyhb B,yhjs C,xtjsb D where A.ygxxbh=B.ygxxbh and B.yh=C.yh and C.jsbh=D.jsbh and A.ygxxbh="+ygxxbh; String sql="select C.jsbh from ygjbxx A,xtyhb B,yhjs C where A.ygxxbh=B.ygxxbh and B.yh=C.yh and A.ygxxbh="+ygxxbh; System.out.println(sql); OpenDB open=new OpenDB("sqlserver"); return open.getColList(sql);在XtjsbActionForm里只添加了两个属性jsbh,jsxm
这个是Action public class YginfoAction extends DispatchAction { public ActionForward getFirstPage(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { //YginfoActionForm form = (YginfoActionForm) actionForm; List list=YginfoAccess.getYginfos(""); request.setAttribute("yginfos",list); return mapping.findForward("yginfo"); } public ActionForward operateUpdate(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { int ygxxbh=Integer.parseInt(request.getParameter("ygxxbh")); YginfoActionForm form=YginfoAccess.getOneYginfo(ygxxbh); request.setAttribute("oneyginfo",form); List htmloptionlist=BmxxAccess.getBMHttpOptionList(); request.setAttribute("htmloptionlist",htmloptionlist); return mapping.findForward("ygupdate"); } public ActionForward operateJsxx(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { YginfoActionForm form = (YginfoActionForm) actionForm; int ygxxbh=form.getYgxxbh(); List jslist=XtjsbAccess.getJsxxs(""); request.setAttribute("jsxxs",jslist); List yhjs=XtjsbAccess.getYhjsxxs(ygxxbh); request.setAttribute("yhjsxxs",yhjs); return mapping.findForward("xtjsb"); } public ActionForward executeUpdate(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { return null; } public ActionForward executeYhjsxxs(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { return null; } }
ygjbxx的属性:ygxxbh,xm,yhbh、、、、、、、
xtyhb:yhbh,yhmc、、、、、、
yhjs:yhbh,jsbh、、、、、、
xtjsb:jsbh,jsxm、、、、、、
这是access类
public static List getJsxxs(String cond){
String sql="select D.jsbh,D.jsmc from ygjbxx A,xtyhb B,yhjs C,xtjsb D where A.ygxxbh=B.ygxxbh and B.yh=C.yh and C.jsbh=D.jsbh "+cond;
System.out.println(sql);
return Java_reflect.GetBeanList(sql,XtjsbActionForm.class);}public static List getYhjsxxs(int ygxxbh){
//String sql="select D.jsbh from ygjbxx A,xtyhb B,yhjs C,xtjsb D where A.ygxxbh=B.ygxxbh and B.yh=C.yh and C.jsbh=D.jsbh and A.ygxxbh="+ygxxbh;
String sql="select C.jsbh from ygjbxx A,xtyhb B,yhjs C where A.ygxxbh=B.ygxxbh and B.yh=C.yh and A.ygxxbh="+ygxxbh;
System.out.println(sql);
OpenDB open=new OpenDB("sqlserver");
return open.getColList(sql);在XtjsbActionForm里只添加了两个属性jsbh,jsxm
public class YginfoAction extends DispatchAction {
public ActionForward getFirstPage(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
//YginfoActionForm form = (YginfoActionForm) actionForm;
List list=YginfoAccess.getYginfos("");
request.setAttribute("yginfos",list);
return mapping.findForward("yginfo");
}
public ActionForward operateUpdate(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
int ygxxbh=Integer.parseInt(request.getParameter("ygxxbh"));
YginfoActionForm form=YginfoAccess.getOneYginfo(ygxxbh);
request.setAttribute("oneyginfo",form);
List htmloptionlist=BmxxAccess.getBMHttpOptionList();
request.setAttribute("htmloptionlist",htmloptionlist);
return mapping.findForward("ygupdate");
}
public ActionForward operateJsxx(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
YginfoActionForm form = (YginfoActionForm) actionForm;
int ygxxbh=form.getYgxxbh(); List jslist=XtjsbAccess.getJsxxs("");
request.setAttribute("jsxxs",jslist);
List yhjs=XtjsbAccess.getYhjsxxs(ygxxbh);
request.setAttribute("yhjsxxs",yhjs);
return mapping.findForward("xtjsb");
}
public ActionForward executeUpdate(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
return null;
}
public ActionForward executeYhjsxxs(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) {
return null;
}
}