先耐心让我把问题描述一下:
1)<a href="credit.html">查询所有信用证</a> 
通过这个 跳到action
2) <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction">
<forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"></forward>
   </action>这个action的作用是查询所有的信用证,在页面显示
3)  <TR align="center" borderColor="#999999" class="ItemTitle">
<td width="80" class="ItemTitle">信用证号</td>
<td width="131" class="ItemTitle">合同/协议号</td>
<td width="120" class="ItemTitle">合同标的</td>
<td width="40" class="ItemTitle">类型</td>
<td width="150" class="ItemTitle">开证银行</td>
<td width="120" class="ItemTitle">议付行</td>
<td width="80" class="ItemTitle">开证人</td>
<td width="40" class="ItemTitle">币种</td>
<td width="40" class="ItemTitle">状态</td>
<td width="40" class="ItemTitle">修改</td>
<td width="40" class="ItemTitle">删除</td>
</tr> <c:forEach items="${creditList}" var="credit">
<TR align="center" borderColor="#999999" class="ItemBody">
<td align="center">${credit.id }</TD>
<td align="center">${credit.contractNo }</td>
<td align="center">${credit.contractMark }</td>
<td align="center">${credit.lcType }</td>
<td align="center">${credit.issuingBankforeign }</td>
<td align="center">${credit.bpBank }</td>
<td align="center">${credit.application }</td>
<td align="center">${credit.idCurrency }</td>
<td align="center">${credit.lcStatus }</td>
<td align="center"><a href="amendCredit.html?cid=${credit.id }">修改</a></td>
<td align="center"><a href="deleteCredit.html?cid=${credit.id }">删除</a></td>
</tr>
</c:forEach>在显示的每条记录右边有个 删除,点击会删除相应的记录4) <action path="/amendCredit" type="fund.mt.web.action.SelectCreditStoreroomAction">
<forward name="success" path="/WEB-INF/pages/mt/ckxyzrk_mod.jsp"></forward>
 </action>配置文件中删除5)public class DeleteCreditStoreroomAction extends Action {

public static CreditStoreroomService credit=new CreditStoreroomService();

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

credit.deleteById(request.getParameter("cid"));

return mapping.findForward("success");
}}
删除的action问题是这样的: 删除完成后,我是让它跳到本页面的,数据库中已经删除了,但是页面中该条记录还在,求各位大虾帮忙。问题补充:删除完成后 要是退出本页面,重新访问,那条记录也是删除了的

解决方案 »

  1.   

    删除后 应 跳转 到 查询的(.do)而不是跳转到 .jsp页面
      

  2.   

    郁闷 两个action都发错了 2)应该是 <action path="/credit" type="fund.mt.web.action.CreditStoreroomAction">
    <forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"></forward>
    </action>4)应该是 <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction">
    <forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"></forward>
    </action>
    1楼的意思是 4中  path="credit.do" ? 我试过的 还是不行
      

  3.   

    先耐心让我把问题描述一下: 
    1) <a href="credit.html">查询所有信用证 </a> 
    通过这个 跳到action 
    2) <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction"> 
            <forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"> </forward> 
        </action> 
    红色部分的意思好像是删除信用证. lz 是不是写错了。
      

  4.   

    lz 这样改试一试:4)应该是 <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction"> 
                    <forward name="success" path="credit.do" ></forward> 
             </action> 
      

  5.   

    lz 这样改试一试: 4)应该是 <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction"> 
                    <forward name="success" path="credit.do" type="redirect"> </forward> 
            </action> 
      

  6.   

    问题应该是出现在删除action里面 我把删除对应上网path改成其他页面也不能跳转过去,删除后程序似乎在这个action出不来了,点刷新的话会看见控制台一直执行删除刚才那个id对应的记录。 
    删除action如下 public class DeleteCreditStoreroomAction extends DispatchAction {

    public static CreditStoreroomService credit=new CreditStoreroomService();

    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    System.out.println(request.getParameter("cid")+"=======================");
    credit.deleteById(request.getParameter("cid"));
    System.out.println("=========================================");

    return mapping.findForward("success");
    }
    }http://localhost:8080/sicdemo/deleteCredit.html?cid=1002 点玩删除 URL对应这个地址,如果刷新的话,还会看见“====”
      

  7.   

    你点击删除玩后应该从新从数据库中查出数据返回当前页面,这样就是显示删完后的数据了。
     <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction"> 
                    
    <forward name="success" path="credit.do" > </forward>    
     </action>
    credit.do应该是从数据库查出数据返回当前页面的跳转! 
      

  8.   

    问题是 现在 执行完删除的DeleteCreditStoreroomAction 后, 似乎程序不能从这个类里跑出来了, 无论我把
    <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction"> 
                    
    <forward name="success" path="credit.do" > </forward>    
    </action> 的path 改成什么都 不能跳转了
      

  9.   

    那就换个思路:
    return mapping.findForward("success");
    改成
    return 查询方法(mapping, form, request, response);
      

  10.   

    只用过 mapping.findForward();不知道你说的怎么用
      

  11.   

    问题已经解决,谢谢大家的帮忙。解决方法如下:删除action:
    public class DeleteCreditStoreroomAction extends DispatchAction {

    public static CreditStoreroomService credit=new CreditStoreroomService();

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    System.out.println(request.getParameter("cid")+"=======================");
    credit.deleteById(request.getParameter("cid"));
    System.out.println("=========================================");


            List list=credit.getAll();

    HttpSession session=request.getSession();

    session.setAttribute("creditList", list);

    return mapping.findForward("success");
    }}
    对应的配置文件:
    <action path="/credit" type="fund.mt.web.action.CreditStoreroomAction">
    <forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"></forward>
    </action>
    <action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction">
    <forward name="success" path="/WEB-INF/pages/mt/ckxyzrk.jsp"></forward>
    </action>
    第一:我觉得很可能是 没有标注 @Override的原因,标注了它后,程序就能走出action了
    第二:我在删除的action里面重新做了 查询所有的记录,跳到查询页面
      

  12.   

    这个不是@Override的问题,在你Action 中重新从数据库中查询当然能显示出来全部的,可以以前我做的不是这样的啊,就是删除了之后,他会自动从数据库获取新数据啊,自动刷新数据啊?你是不是哪写的有问题啊
      

  13.   

    你的list刚开始是从session里取出来,
    当你完后,点击删除时,数据库肯定删除了,删除完了你是直接跳到JSP 页面,
    return mapping.findForward("success"); 所以JSP页面的list依然是session里取了一次。而不是从数据库从新取了一遍。所以session里里面不管你怎么删除都与它无关系!说错了不要建议。!!!!