public void delUserByID(Integer id){ 
  
  Session session = getSession(); 
  Transaction trans = session.beginTransaction(); 
  User u= (User)session.get("User.class", id); 
  session.delete(u);
  trans.commit(); 
  session.close(); 

解决方案 »

  1.   

    老大你的application.resource.资源文件里有你说的
    protected Map getKeyMethodMap() {
    Map map  =new HashMap();
    map.put("button.del", "del");
    map.put("button.add","add");
    map.put("button.userList", "userList");
    map.put("button.update","update");
    return map;
    }  ,del ,add,userList ,update 有在资源文件里申明吗?Action[/regedit] missing resource 'method' in key method map ,错误很明显啊!
      

  2.   

    <a href="regedit.do?">显示 </a>
       请问?这后面的参数如何跟啊? 你把.do看成.jsp,jsp的url传值!其实可以这样用的!
      

  3.   

    就是用<a href="regedit.do?">显示  </a>去访问,别的都没有什么问题,就是如何写这一个URL  不要乱去找别的地方错,别的地方没有错误....
      

  4.   

    问题1楼上的说了.
    问题2:
    public void delUserByID(int id){ 
      
      Session session = this.getSession(); 
      Transaction trans = session.beginTransaction(); 
      String hql="delete from UserPo where id =?"; 
      Query q=session.createQuery(hql); 
       q.setInteger(0,id);
      session.execute();
      trans.commit(); 
      session.close(); 
      

  5.   

    什么跟什么哦,问题二太明显:String hql="delete from UserPo where id"+id; 明显红色那里少了个‘=’号,问题1 也是太明显:<a href="regedit.do?">显示   </a>。‘?’后面要带上你要执行的方法啊,传个参数过去,比如你要让Action执行add,就应该是:<a href="regedit.do?method=add">你这个参数的名称必须是method因为在你xml文件里面配了这一个属性<action 
          attribute="regeditForm" 
          name="regeditForm" 
          parameter="method" 
          path="/regedit" 
          scope="request" 
          type="com.lovo.struts.action.RegeditAction"> 
           <forward name="success" path="/success.jsp" /> 
           <forward name="main" path="/main.jsp" /> 
           <forward name="falide" path="/falide.jsp" /> 
         </action> 
    红色的就是属性名称。
      

  6.   

    楼上的朋友你说的这个是DispacthAction 
    我问的是他的子类LookupDispacthAction 
    <a href="regedit.do?">显示   </a>去访问,别的都没有什么问题,就是如何写这一个URL  
      

  7.   

      我晓得你说的那是他的父类型DispatchAction嘛
    我是说lookupDispacthAction 的
    URL如何跟啊.
      

  8.   

    1、regedit.do?method=del
    2、用QBC删除DetachedCriteria de = DetachedCriteria.forClass(TbAccess.class);
    de.add(Restrictions.eq("ID", tbac.getId()));
    ((IAccessDao)getService("AccessDao")).del_Object(de);