作者: kent鹏
转载请注明出处: http://www.cnblogs.com/xieyupeng/p/7159337.html
一、联系人添加
1.添加页面设计
linkman/list.jsp:
<input type="button" value="选择客户" onclick="window.open('${pageContext.request.contextPath}/CustomerAction_list?select=true','','width=600,height=300')" />
coustomer/list.jsp
function selectCustomer(cust_id,cust_name){ //获得添加页面的window对象 var win = window.opener; //获得添加页面的document对象 var doc = win.document; //获得隐藏域,和 文本框,并赋值 doc.getElementById("cust_id").value=cust_id; doc.getElementById("cust_name").value=cust_name; //关闭当前窗口 window.close(); };
<s:if test="#parameters.select==null"> <a href="${pageContext.request.contextPath }/CustomerAction_toEdit?cust_id=<s:property value="#cust.cust_id" />">修改</a> <a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a> </s:if> <s:else> <input type="button" value="选择" onclick="selectCustomer(<s:property value="#cust.cust_id" />,'<s:property value="#cust.cust_name" />')" /> </s:else>
2.添加客户
二、联系人列表
按照客户列表完成(抄)
三、联系人修改
注:后台使用同一个方法完成添加和更新功能