先耐心让我把问题描述一下:
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)<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问题是这样的: 删除完成后,我是让它跳到本页面的,数据库中已经删除了,但是页面中该条记录还在,求各位大虾帮忙。问题补充:删除完成后 要是退出本页面,重新访问,那条记录也是删除了的
解决方案 »
- 求问,SVN总是无法注册系统服务成功
- 请教一下 如何在页面不刷新的情况下更新在前台循环session的值
- javamail问题 请做过的朋友帮忙看看
- 对于Web Service如何入门?
- 解决查询 显示 速度??(前提:数据库已经优化好了,只是需要程序的优化)
- 我到BEA网站注册之后怎么找不到weblogic下载的地方???
- ▲在家靠父母,网上靠朋友,请有“码”的捧个“码”场(即源代码),没码的捧个人场(UP一下)来者有分!▲
- Javamail的mail.jar怎么用啊?急!!!
- java中对图片的处理?急用
- 为什么 ejb 不直接 implements bean 的 interface
- 请教各位高手:我的类型转换错误
- Spring中,A的属性中有B,B的属性中有A
<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" ? 我试过的 还是不行
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 是不是写错了。
<forward name="success" path="credit.do" ></forward>
</action>
<forward name="success" path="credit.do" type="redirect"> </forward>
</action>
删除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对应这个地址,如果刷新的话,还会看见“====”
<action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction">
<forward name="success" path="credit.do" > </forward>
</action>
credit.do应该是从数据库查出数据返回当前页面的跳转!
<action path="/deleteCredit" type="fund.mt.web.action.DeleteCreditStoreroomAction">
<forward name="success" path="credit.do" > </forward>
</action> 的path 改成什么都 不能跳转了
return mapping.findForward("success");
改成
return 查询方法(mapping, form, request, response);
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里面重新做了 查询所有的记录,跳到查询页面
当你完后,点击删除时,数据库肯定删除了,删除完了你是直接跳到JSP 页面,
return mapping.findForward("success"); 所以JSP页面的list依然是session里取了一次。而不是从数据库从新取了一遍。所以session里里面不管你怎么删除都与它无关系!说错了不要建议。!!!!