案例54-crm练习新增联系人
1 前台页面部分
1 linkman/add.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<TITLE>添加联系人</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="${pageContext.request.contextPath }/css/Style.css" type=text/css rel=stylesheet>
<LINK href="${pageContext.request.contextPath }/css/Manage.css" type=text/css
rel=stylesheet> <META content="MSHTML 6.00.2900.3492" name=GENERATOR>
</HEAD>
<BODY>
<FORM id=form1 name=form1
action="${pageContext.request.contextPath }/LinkManAction_add"
method=post> <TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15><IMG src="${pageContext.request.contextPath }/images/new_019.jpg"
border=0></TD>
<TD width="100%" background="${pageContext.request.contextPath }/images/new_020.jpg"
height=20></TD>
<TD width=15><IMG src="${pageContext.request.contextPath }/images/new_021.jpg"
border=0></TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15 background=${pageContext.request.contextPath }/images/new_022.jpg><IMG
src="${pageContext.request.contextPath }/images/new_022.jpg" border=0></TD>
<TD vAlign=top width="100%" bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
<TR>
<TD class=manageHead>当前位置:联系人管理 > 添加联系人</TD>
</TR>
<TR>
<TD height=2></TD>
</TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=5 border=0>
<tr>
<td>所属客户:</td>
<td>
<!--隐藏域 用于传递选择客户的cust_id -->
<input type="hidden" name="customer.cust_id" id="cust_id"/> <!-- 只用于页面的客户名称显示,根本不需要提交,所以不需要name属性 -->
<input type="text" id="cust_name" style="WIDTH: 180px"/>
</td>
<td>
<input type="button" value="选择客户"
onclick="window.open(
'${pageContext.request.contextPath}/CustomerAction_list?selected=true','',
'height=300,width=600,left=850,top=200')">
</td>
</tr>
<TR>
<td>联系人名称:</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_name">
</td>
<td>联系人性别:</td>
<td>
<input type="radio" value="1" name="lkm_gender">男
<input type="radio" value="2" name="lkm_gender">女
</td>
</TR>
<TR>
<td>联系人办公电话 :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_phone">
</td>
<td>联系人手机 :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_mobile">
</td>
</TR>
<TR>
<td>联系人邮箱 :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_email">
</td>
<td>联系人QQ :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_qq">
</td>
</TR>
<TR>
<td>联系人地址 :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_position">
</td>
<td>联系人备注 :</td>
<td>
<INPUT class=textbox id=sChannel2
style="WIDTH: 180px" maxLength=50 name="lkm_memo">
</td>
</TR>
<tr>
<td rowspan=2>
<INPUT class=button id=sButton2 type=submit
value="保存 " name=sButton2>
</td>
</tr>
</TABLE> </TD>
<TD width=15 background="${pageContext.request.contextPath }/images/new_023.jpg">
<IMG src="${pageContext.request.contextPath }/images/new_023.jpg" border=0></TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15><IMG src="${pageContext.request.contextPath }/images/new_024.jpg"
border=0></TD>
<TD align=middle width="100%"
background="${pageContext.request.contextPath }/images/new_025.jpg" height=15></TD>
<TD width=15><IMG src="${pageContext.request.contextPath }/images/new_026.jpg"
border=0></TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</BODY>
</HTML>
2 customer/list.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<TITLE>客户列表</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<LINK href="${pageContext.request.contextPath }/css/Style.css"
type=text/css rel=stylesheet>
<LINK href="${pageContext.request.contextPath }/css/Manage.css"
type=text/css rel=stylesheet>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.4.4.min.js"></script>
<SCRIPT language=javascript>
function changePage(pageNum){
//alert(pageNum);
//1 将页码的值放入对应表单隐藏域中
$("#currentPageInput").val(pageNum);
//2提交表达
$("#pageForm").submit();
}; function changePageSize(pageSize){
//alert(pageSize);
//1 将页码的值放入对应表单隐藏域中
$("#pageSizeInput").val(pageSize);
//2提交表达
$("#pageForm").submit();
}; //选择客户的js代码
function selectCustomer(id,name){
//alert(id+":"+name);
// 1获取到打开当前页面的页面的window对象
var win = window.opener;
// 2获取到打开当前页面的页面的document对象
var doc = win.document;
// 3获取到页面的客户属性选择组件并复制
doc.getElementById("cust_name").value=name;
doc.getElementById("cust_id").value=id;
}; </SCRIPT> <META content="MSHTML 6.00.2900.3492" name=GENERATOR>
</HEAD>
<BODY>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15><IMG
src="${pageContext.request.contextPath }/images/new_019.jpg"
border=0></TD>
<TD width="100%"
background="${pageContext.request.contextPath }/images/new_020.jpg"
height=20></TD>
<TD width=15><IMG
src="${pageContext.request.contextPath }/images/new_021.jpg"
border=0></TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15 background=${pageContext.request.contextPath }
/images/new_022.jpg><IMG
src="${pageContext.request.contextPath }/images/new_022.jpg"
border=0></TD>
<TD vAlign=top width="100%" bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
<TR>
<TD class=manageHead>当前位置:客户管理 > 客户列表</TD>
</TR>
<TR>
<TD height=2></TD>
</TR>
</TABLE>
<TABLE borderColor=#cccccc cellSpacing=0 cellPadding=0 width="100%"
align=center border=0>
<TBODY>
<TR>
<TD height=25>
<FORM id="pageForm" name="customerForm"
action="${pageContext.request.contextPath }/CustomerAction_list"
method=post>
<!-- 隐藏域 用于传递当前页面 -->
<input type="hidden" name="currentPage" id="currentPageInput"
value="<s:property value="#pageBean.currentPage"/>">
<!-- 隐藏域 用于传递每页显示的条数 -->
<input type="hidden" name="pageSize" id="pageSizeInput"
value="<s:property value="#pageBean.pageSize"/>"> <!-- 隐藏域 用于判断是否是选择客户页面 -->
<input type="hidden" name="selected" value="parameters.selected" /> <TABLE cellSpacing=0 cellPadding=2 border=0>
<TBODY>
<TR>
<TD>客户名称:</TD>
<TD><INPUT class=textbox id=sChannel2
style="WIDTH: 80px" maxLength=50 name="cust_name"
value="${param.cust_name}"></TD> <TD><INPUT class=button id=sButton2 type=submit
value=" 筛选 " name=sButton2></TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</TD>
</TR> <TR>
<TD>
<TABLE id=grid
style="BORDER-TOP-WIDTH: 0px; FONT-WEIGHT: normal; BORDER-LEFT-WIDTH: 0px; BORDER-LEFT-COLOR: #cccccc; BORDER-BOTTOM-WIDTH: 0px; BORDER-BOTTOM-COLOR: #cccccc; WIDTH: 100%; BORDER-TOP-COLOR: #cccccc; FONT-STYLE: normal; BACKGROUND-COLOR: #cccccc; BORDER-RIGHT-WIDTH: 0px; TEXT-DECORATION: none; BORDER-RIGHT-COLOR: #cccccc"
cellSpacing=1 cellPadding=2 rules=all border=0>
<TBODY>
<TR
style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none">
<TD>客户名称</TD>
<TD>客户级别</TD>
<TD>客户来源</TD>
<TD>联系人</TD>
<TD>电话</TD>
<TD>手机</TD>
<TD>操作</TD>
</TR>
<s:iterator value="#pageBean.list" var="cust">
<TR
style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
<TD><s:property value="#cust.cust_name" /></TD>
<TD><s:property value="#cust.cust_level" /></TD>
<TD><s:property value="#cust.cust_source" /></TD>
<TD><s:property value="#cust.cust_linkman" /></TD>
<TD><s:property value="#cust.cust_phone" /></TD>
<TD><s:property value="#cust.cust_mobile" /></TD> <s:if test="#parameters.selected==null">
<TD><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>
</TD>
</s:if>
<s:else>
<td colspan="1">
<input type="button" value="选择"
onclick="selectCustomer(<s:property value="#cust.cust_id" />,'<s:property value="#cust.cust_name" />')" />
</td>
</s:else>
</TR>
</s:iterator>
<%-- <s:iterator value="#list" >
<TR
style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
<TD>
<s:property value="cust_name" />
</TD>
<TD>
<s:property value="cust_level" />
</TD>
<TD>
<s:property value="cust_source" />
</TD>
<TD>
<s:property value="cust_linkman" />
</TD>
<TD>
<s:property value="cust_phone" />
</TD>
<TD>
<s:property value="cust_mobile" />
</TD>
<TD>
<a href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
<a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
</TD>
</TR>
</s:iterator> --%>
<%-- <c:forEach items="${list }" var="customer">
<TR
style="FONT-WEIGHT: normal; FONT-STYLE: normal; BACKGROUND-COLOR: white; TEXT-DECORATION: none">
<TD>${customer.cust_name }</TD>
<TD>${customer.cust_level }</TD>
<TD>${customer.cust_source }</TD>
<TD>${customer.cust_linkman }</TD>
<TD>${customer.cust_phone }</TD>
<TD>${customer.cust_mobile }</TD>
<TD>
<a href="${pageContext.request.contextPath }/customerServlet?method=edit&custId=${customer.cust_id}">修改</a>
<a href="${pageContext.request.contextPath }/customerServlet?method=delete&custId=${customer.cust_id}">删除</a>
</TD>
</TR> </c:forEach> --%> </TBODY>
</TABLE>
</TD>
</TR> <TR>
<TD><SPAN id=pagelink>
<DIV
style="LINE-HEIGHT: 20px; HEIGHT: 20px; TEXT-ALIGN: right">
共[<B><s:property value="#pageBean.totalCount" /></B>]条记 录,[<B>
<s:property value="#pageBean.currentPage" />
</B>]页 ,每页显示
<select name="pageSize" id="selectPageSize" onchange="changePageSize($('#selectPageSize option:selected').val())" >
<option value="1" <s:property value="#pageBean.pageSize==1?'selected':''"/>>1</option>
<option value="2" <s:property value="#pageBean.pageSize==2?'selected':''"/>>2</option>
<option value="3" <s:property value="#pageBean.pageSize==3?'selected':''"/>>3</option>
<option value="4" <s:property value="#pageBean.pageSize==4?'selected':''"/>>4</option>
<option value="5" <s:property value="#pageBean.pageSize==5?'selected':''"/>>5</option>
</select> 条
[<A href="javaScript:void(0)"
onclick="changePage(<s:property value='#pageBean.currentPage-1' />)">前一页</A>]
<%-- <B>${page}</B> --%>
[<A href="javaScript:void(0)"
onclick="changePage(<s:property value='#pageBean.currentPage+1' />)">后一页</A>]
到 <input type="text" size="3" id="page" name="page"
value="<s:property value='#pageBean.currentPage'/>" /> 页 <input
type="button" value="Go"
onclick="changePage($('#page').val())" />
</DIV>
</SPAN></TD>
</TR>
</TBODY>
</TABLE>
</TD>
<TD width=15
background="${pageContext.request.contextPath }/images/new_023.jpg"><IMG
src="${pageContext.request.contextPath }/images/new_023.jpg"
border=0></TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD width=15><IMG
src="${pageContext.request.contextPath }/images/new_024.jpg"
border=0></TD>
<TD align=middle width="100%"
background="${pageContext.request.contextPath }/images/new_025.jpg"
height=15></TD>
<TD width=15><IMG
src="${pageContext.request.contextPath }/images/new_026.jpg"
border=0></TD>
</TR>
</TBODY>
</TABLE>
<s:debug></s:debug>
</BODY>
</HTML>
2 后台部分
1 LinkManAction
package www.test.web.action; import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven; import www.test.domain.LinkMan;
import www.test.service.LinkManService; public class LinkManAction extends ActionSupport implements ModelDriven<LinkMan> { private LinkMan lm = new LinkMan();
private LinkManService lms; public String add() throws Exception { // 1调用service执行保存操作
lms.save(lm);
// 2重定向到联系人列表action
return "toList";
} @Override
public LinkMan getModel() { return lm;
} public LinkManService getLms() {
return lms;
}
public void setLms(LinkManService lms) {
this.lms = lms;
} }
2 LinkManServiceImpl
package www.test.service.impl; import www.test.dao.LinkManDao;
import www.test.domain.LinkMan;
import www.test.service.LinkManService; public class LinkManServiceImpl implements LinkManService { private LinkManDao lmd;
@Override
//保存联系人
public void save(LinkMan lm) {
//直接调用dao的方法保存即可
lmd.saveOrUpdate(lm);
}
public LinkManDao getLmd() {
return lmd;
}
public void setLmd(LinkManDao lmd) {
this.lmd = lmd;
} }
案例54-crm练习新增联系人的更多相关文章
- 在标准实体特殊消息上注册插件及Dynamics CRM 2015中计算字段的使用
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复157或者20151005可方便获取本文,同时可以在第一时间得到我发布的最新的博文信息,follow me! 前面的 插件系列博客教程 讲述了 ...
- CRM是什么,你有认真了解过CRM吗?
这是CRM的一个简单定义 客户关系管理 (CRM)是一种用于管理公司与客户和潜在客户的所有关系和互动的技术.目标很简单:改善业务关系.CRM 系统可帮助公司与客户保持联系.简化流程并提高盈利能力. 当 ...
- Maven+ajax+SSM实现新增
转载自:https://www.cnblogs.com/kebibuluan/p/9014986.html 20.尚硅谷_SSM高级整合_新增_创建员工新增的模态框.avi 1.接下来当我们点击增加按 ...
- 【WP8.1开发】基于应用的联系人存储
上一篇文章所吹的牛是访问系统(手机)上的联系人,当然那只是读不能改,这是自然的,要是让你能随便修改用户的联系人信息的话,那后果很严重,有些恶意开发者就有可能把”你的户口改成猪“. 但是,API也允许应 ...
- Dynamics CRM中跨域调用Web API 2
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复224或者20160611可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong. ...
- iOS-----使用AddressBookUI管理联系人
使用AddressBookUI管理联系人 iOS SDK为管理地址簿提供的视图控制器位于AddressBookUI框架内.总结来说,AddressBookUI框架提供了如下特殊的视图控制器. ABPe ...
- 案例41-hibernate练习-添加客户
1 utils部分 1 HibernateUtils package www.test.utils; import org.hibernate.Session; import org.hibernat ...
- PowerMock学习(一)之PoweMock的入门--模拟新增学生操作
关于powermock 在TDD领域Mock框架有很多,比如EasyMock,JMock,Mockito.可能有些同学会好奇了,为什么要重点把powermock拿出来呢,因为powermock可以解决 ...
- 在VM虚拟机Windows Server r2上部署安装Microsoft Dynamics CRM 2016 步骤详解(一)
应公司需求,最近在学微软的Dynamics CRM.在搭建环境的过程中也遇到了一些雷坑,在这里分享一下安装部署过程当中所遇到的一些问题, 安装Microsoft Dynamics CRM 2016的几 ...
随机推荐
- 《Linux内核设计与实现》读书笔记(八)- 中断下半部的处理
在前一章也提到过,之所以中断会分成上下两部分,是由于中断对时限的要求非常高,需要尽快的响应硬件. 主要内容: 中断下半部处理 实现中断下半部的机制 总结中断下半部的实现 中断实现示例 1. 中断下半部 ...
- C# WinForm:无法访问已释放的对象
C#在父窗口中调用子窗口的过程: 1. 创建子窗口对象 2. 显示子窗口对象 笔者的程序中,主窗体MainFrm通过菜单调用子窗口ChildFrm.在窗体中定义了子窗口对象,然后在菜单项点击事件中 ...
- ChineseLunisolarCalendar 农历日期
#region 农历日期 static ChineseLunisolarCalendar cCalendar = new ChineseLunisolarCalendar(); /// <sum ...
- win10下安装配置mysql-8.0.13--实战可用
1.下载mysql-8.0.13安装包 1 https://dev.mysql.com/downloads/mysql/ 选择zip安装包下载就好. 2.解压到你要安装的目录 3.创建my.ini配置 ...
- AngularJS(三)——指令实战及自定义指令
前言 上篇介绍了一些指令的应用,本篇介绍一些常用的用法格式. 内容 指令实战 下面通过输入一个名字实现实时更新文本内容. 需要的指令有: ng-app.ng-model.ng-bind.n-init ...
- web.xml 有什么用?(Java框架)
1.每个javaEE工程中都有web.xml文件,那么它的作用是什么呢?它是每个web.xml工程都必须的吗? 一个web中可以没有web.xml文件,也就是说,web.xml文件并不是web工程 ...
- CSS之字体样式
css字体样式 font-size:字号大小 font-size属性用于设置字号,该属性的值可以使用相对长度单位,也可以使用绝对长度单位.其中,相对长度单位比较常用,推荐使用像素单位px,绝对单位使用 ...
- Flashcache的 KEEP属性自动失效
如果希望一个数据对象长期地缓存在flashcache中,则可以手动地将该数据对象的CELL_FLASH_CACHE属性设置为"keep". 其实需要说明的是,但不是数据对象的CEL ...
- 二叉树的遍历 &【NOIP2001普及组】& 洛谷 P1030 求先序排列
题目链接 https://www.luogu.org/problemnew/show/P1030 模板题 先讲一下二叉树的遍历 二叉树的遍历 分类 性质 求法 分为三类: 先序遍历(PreOrder) ...
- AD属性常量类
参考:http://www.selfadsi.org/user-attributes.htm namespace Common { /// <summary> /// AD中的属性,没有出 ...