MyEclipse (iii)

Source: Internet
Author: User
Tags stub

The practice of small semesters is coming to an end unconsciously.

The project is almost complete, this time I'll talk about how to delete the customer information to do, in fact, his operation and save the new customer information is similar.

First, in the front-end custinfo.jsp, there is a delete button.

<s:a href= "delectcust.action?cust.id=%{#cust. ID}" onclick= "return Fundelete ();" > Delete </s:a>

It does the request transformation through the Strust.xml file as an intermediate file:

 1  <!--  delete  -->  2  <   Action  name  = "Delectcust"   class  = "Removecustaction"  >  3  <   Result  > /jsp/custinfo.jsp</  result  >  4  </  Action  >  

This class of removecustaction in this file corresponds to the corresponding name in the Applicationcontext.xml file:

1 <!--configuration-delete deleteaction -2     <BeanID= "Removecustaction"class= "Com.crm.action.RemoveCustAction">3         < Propertyname= "Custservice"ref= "Custservice"></ Property>4     </Bean>

This configuration also corresponds to the Removecustaction class, which is the implementation of deleting this action

1  Packagecom.crm.action;2 3 ImportCom.crm.bean.Cust;4 ImportCom.crm.service.CustService;5 ImportCom.opensymphony.xwork2.ActionSupport;6 7@SuppressWarnings ("Serial")8  Public classRemovecustactionextendsactionsupport{9 Ten     PrivateCust Cust; One     PrivateCustservice Custservice; A  -  PublicCustservice Getcustservice () { -         returnCustservice; the     } -  -      Public voidSetcustservice (Custservice custservice) { -          This. Custservice =Custservice; +     } -  +@SuppressWarnings ("Unchecked") A @Override at      PublicString Execute ()throwsException { -          This. Custservice.removecustomer (Cust); -         returnSUCCESS; -     } -  -  PublicCust Getcust () { in     returnCust; - } to  +  Public voidsetcust (Cust Cust) { -      This. Cust =Cust; the } *  $}

Add a statement to the two classes in Custdao and Custservice

Public void removecustomer (Cust Cust);

And in the two corresponding implementation files (IMPL), add the following statements, respectively

1  Public void Removecustomer (Cust Cust) {2         // TODO auto-generated Method Stub 3          This . Gethibernatetemplate (). Delete (Cust); 4     }
1  Public void Removecustomer (Cust Cust) {2         // TODO auto-generated Method Stub 3          This . Custdao.removecustomer (Cust); 4     }

MyEclipse (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.