自定义标签

liushisaonian liushisaonian     2022-12-27     569

关键词:

自定义标签分三步

1.实现TagSupport

package com.it.huanyu;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

public class MyTestTag extends TagSupport 

	private static final long serialVersionUID = 1L;

	@Override
	public int doStartTag() throws JspException 
		
		
		JspWriter out=super.pageContext.getOut();
		
		try 
			out.print("<h1>这个是自定义标签输出的大标题</h1>");
			out.print("<h5>这个是自定义标签输出的小标题</h5>");
			out.print("<span>这个是自定义标签输出的内容这个是自定义标签输出的内容这个是自定义标签输出的内容这个是自定义标签输出的内容</span>");
		 catch (IOException e) 
			e.printStackTrace();
		
	
		return super.doStartTag();
	


  

2.写tld文件

技术分享图片

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
	<tlib-version>2.0</tlib-version>
	<jsp-version>1.2</jsp-version>
	<short-name>myTestTag</short-name>
	<uri>http://ithuanyu.cn/myTestTag/</uri>

	<tag>
		<name>out</name>
		<tag-class>com.it.huanyu.MyTestTag</tag-class>
		<body-content>JSP</body-content>
		<description>create navigation for paging</description>
	</tag>
</taglib>

  

3.在页面引入和输出

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="myTestTag" uri="http://ithuanyu.cn/myTestTag/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>自定义标签的使用</title>
</head>
<body>
<!-- 使用自定义标签 -->
<myTestTag:out></myTestTag:out>
</body>
</html>

4.分页标签

 

package com.itheima.crm.utils;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * 显示格式 上一页 1 2 3 4 5 下一页
 */
public class NavigationTag extends TagSupport 
	static final long serialVersionUID = 2372405317744358833L;

	/**
	 * request 中用于保存Page<E> 对象的变量名,默认为“page”
	 */
	private String bean = "page";

	/**
	 * 分页跳转的url地址,此属性必须
	 */
	private String url = null;

	/**
	 * 显示页码数量
	 */
	private int number = 5;

	@Override
	public int doStartTag() throws JspException 
		JspWriter writer = pageContext.getOut();
		HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
		Page page = (Page) request.getAttribute(bean);
		if (page == null)
			return SKIP_BODY;
		url = resolveUrl(url, pageContext);
		try 
			// 计算总页数
			int pageCount = page.getTotal() / page.getSize();
			if (page.getTotal() % page.getSize() > 0) 
				pageCount++;
			
			writer.print("<nav><ul class="pagination">");
			// 显示“上一页”按钮
			if (page.getPage() > 1) 
				String preUrl = append(url, "page", page.getPage() - 1);
				preUrl = append(preUrl, "rows", page.getSize());
				writer.print("<li><a href="" + preUrl + "">上一页</a></li>");
			 else 
				writer.print("<li class="disabled"><a href="#">上一页</a></li>");
			
			// 显示当前页码的前2页码和后两页码
			// 若1 则 1 2 3 4 5, 若2 则 1 2 3 4 5, 若3 则1 2 3 4 5,
			// 若4 则 2 3 4 5 6 ,若10 则 8 9 10 11 12
			int indexPage = (page.getPage() - 2 > 0) ? page.getPage() - 2 : 1;
			for (int i = 1; i <= number && indexPage <= pageCount; indexPage++, i++) 
				if (indexPage == page.getPage()) 
					writer.print("<li class="active"><a href="#">" + indexPage
							+ "<span class="sr-only">(current)</span></a></li>");
					continue;
				
				String pageUrl = append(url, "page", indexPage);
				pageUrl = append(pageUrl, "rows", page.getSize());
				writer.print("<li><a href="" + pageUrl + "">" + indexPage + "</a></li>");
			
			// 显示“下一页”按钮
			if (page.getPage() < pageCount) 
				String nextUrl = append(url, "page", page.getPage() + 1);
				nextUrl = append(nextUrl, "rows", page.getSize());
				writer.print("<li><a href="" + nextUrl + "">下一页</a></li>");
			 else 
				writer.print("<li class="disabled"><a href="#">下一页</a></li>");
			
			writer.print("</nav>");
		 catch (IOException e) 
			e.printStackTrace();
		
		return SKIP_BODY;
	

	private String append(String url, String key, int value) 

		return append(url, key, String.valueOf(value));
	

	/**
	 * 为url 参加参数对儿
	 * 
	 * @param url
	 * @param key
	 * @param value
	 * @return
	 */
	private String append(String url, String key, String value) 
		if (url == null || url.trim().length() == 0) 
			return "";
		

		if (url.indexOf("?") == -1) 
			url = url + "?" + key + "=" + value;
		 else 
			if (url.endsWith("?")) 
				url = url + key + "=" + value;
			 else 
				url = url + "&" + key + "=" + value;
			
		

		return url;
	

	/**
	 * 为url 添加翻页请求参数
	 * 
	 * @param url
	 * @param pageContext
	 * @return
	 * @throws javax.servlet.jsp.JspException
	 */
	private String resolveUrl(String url, javax.servlet.jsp.PageContext pageContext) throws JspException 
		// UrlSupport.resolveUrl(url, context, pageContext)
		Map params = pageContext.getRequest().getParameterMap();
		for (Object key : params.keySet()) 
			if ("page".equals(key) || "rows".equals(key))
				continue;
			Object value = params.get(key);
			if (value == null)
				continue;
			try 
				if (value.getClass().isArray()) 
					// 解决GET乱码问题
					// value = new String(((String[])
					// value)[0].getBytes("ISO-8859-1"), "UTF-8");

					value = ((String[]) value)[0];
					url = append(url, key.toString(), value.toString());
				 else if (value instanceof String) 
					// 解决GET乱码问题
					// value = new String(((String)
					// value).getBytes("ISO-8859-1"), "UTF-8");
					value = (String) value;
					url = append(url, key.toString(), value.toString());
				
			 catch (Exception e) 
				e.printStackTrace();
			
		
		return url;
	

	/**
	 * @return the bean
	 */
	public String getBean() 
		return bean;
	

	/**
	 * @param bean
	 *            the bean to set
	 */
	public void setBean(String bean) 
		this.bean = bean;
	

	/**
	 * @return the url
	 */
	public String getUrl() 
		return url;
	

	/**
	 * @param url
	 *            the url to set
	 */
	public void setUrl(String url) 
		this.url = url;
	

	public void setNumber(int number) 
		this.number = number;
	


  

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
	<tlib-version>2.0</tlib-version>
	<jsp-version>1.2</jsp-version>
	<short-name>common</short-name>
	<uri>http://itcast.cn/common/</uri>
	<display-name>Common Tag</display-name>
	<description>Common Tag library</description>

	<tag>
		<name>page</name>
		<tag-class>com.itheima.crm.utils.NavigationTag</tag-class>
		<body-content>JSP</body-content>
		<description>create navigation for paging</description>
		<attribute>
			<name>bean</name>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
		<attribute>
			<name>number</name>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
		<attribute>
			<name>url</name>
			<required>true</required>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
	</tag>
</taglib>

  

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itcast" uri="http://itcast.cn/common/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>客户列表-BootCRM</title>

<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="<%=basePath%>css/metisMenu.min.css" rel="stylesheet">

<!-- DataTables CSS -->
<link href="<%=basePath%>css/dataTables.bootstrap.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="<%=basePath%>css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet"
	type="text/css">
<link href="<%=basePath%>css/boot-crm.css" rel="stylesheet"
	type="text/css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn‘t work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

	<div id="wrapper">

		<!-- Navigation -->
		<nav class="navbar navbar-default navbar-static-top" role="navigation"
			style="margin-bottom: 0">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target=".navbar-collapse">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="index.html">BOOT客户管理系统 v2.0</a>
		</div>
		<!-- /.navbar-header -->

		<ul class="nav navbar-top-links navbar-right">
			<li class="dropdown"><a class="dropdown-toggle"
				data-toggle="dropdown" href="#"> <i class="fa fa-envelope fa-fw"></i>
					<i class="fa fa-caret-down"></i>
			</a>
				<ul class="dropdown-menu dropdown-messages">
					<li><a href="#">
							<div>
								<strong>令狐冲</strong> <span class="pull-right text-muted">
									<em>昨天</em>
								</span>
							</div>
							<div>今天晚上向大哥找我吃饭,讨论一下去梅庄的事...</div>
					</a></li>
					<li class="divider"></li>
					<li><a class="text-center" href="#"> <strong>查看全部消息</strong>
							<i class="fa fa-angle-right"></i>
					</a></li>
				</ul> <!-- /.dropdown-messages --></li>
			<!-- /.dropdown -->
			<li class="dropdown"><a class="dropdown-toggle"
				data-toggle="dropdown" href="#"> <i class="fa fa-tasks fa-fw"></i>
					<i class="fa fa-caret-down"></i>
			</a>
				<ul class="dropdown-menu dropdown-tasks">
					<li><a href="#">
							<div>
								<p>
									<strong>任务 1</strong> <span class="pull-right text-muted">完成40%</span>
								</p>
								<div class="progress progress-striped active">
									<div class="progress-bar progress-bar-success"
										role="progressbar" aria-valuenow="40" aria-valuemin="0"
										aria-valuemax="100" style="width: 40%">
										<span class="sr-only">完成40%</span>
									</div>
								</div>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a href="#">
							<div>
								<p>
									<strong>任务 2</strong> <span class="pull-right text-muted">完成20%</span>
								</p>
								<div class="progress progress-striped active">
									<div class="progress-bar progress-bar-info" role="progressbar"
										aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"
										style="width: 20%">
										<span class="sr-only">完成20%</span>
									</div>
								</div>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a class="text-center" href="#"> <strong>查看所有任务</strong>
							<i class="fa fa-angle-right"></i>
					</a></li>
				</ul> <!-- /.dropdown-tasks --></li>
			<!-- /.dropdown -->
			<li class="dropdown"><a class="dropdown-toggle"
				data-toggle="dropdown" href="#"> <i class="fa fa-bell fa-fw"></i>
					<i class="fa fa-caret-down"></i>
			</a>
				<ul class="dropdown-menu dropdown-alerts">
					<li><a href="#">
							<div>
								<i class="fa fa-comment fa-fw"></i> 新回复 <span
									class="pull-right text-muted small">4分钟之前</span>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a href="#">
							<div>
								<i class="fa fa-envelope fa-fw"></i> 新消息 <span
									class="pull-right text-muted small">4分钟之前</span>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a href="#">
							<div>
								<i class="fa fa-tasks fa-fw"></i> 新任务 <span
									class="pull-right text-muted small">4分钟之前</span>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a href="#">
							<div>
								<i class="fa fa-upload fa-fw"></i> 服务器重启 <span
									class="pull-right text-muted small">4分钟之前</span>
							</div>
					</a></li>
					<li class="divider"></li>
					<li><a class="text-center" href="#"> <strong>查看所有提醒</strong>
							<i class="fa fa-angle-right"></i>
					</a></li>
				</ul> <!-- /.dropdown-alerts --></li>
			<!-- /.dropdown -->
			<li class="dropdown"><a class="dropdown-toggle"
				data-toggle="dropdown" href="#"> <i class="fa fa-user fa-fw"></i>
					<i class="fa fa-caret-down"></i>
			</a>
				<ul class="dropdown-menu dropdown-user">
					<li><a href="#"><i class="fa fa-user fa-fw"></i> 用户设置</a></li>
					<li><a href="#"><i class="fa fa-gear fa-fw"></i> 系统设置</a></li>
					<li class="divider"></li>
					<li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i>
							退出登录</a></li>
				</ul> <!-- /.dropdown-user --></li>
			<!-- /.dropdown -->
		</ul>
		<!-- /.navbar-top-links -->

		<div class="navbar-default sidebar" role="navigation">
			<div class="sidebar-nav navbar-collapse">
				<ul class="nav" id="side-menu">
					<li class="sidebar-search">
						<div class="input-group custom-search-form">
							<input type="text" class="form-control" placeholder="查询内容...">
							<span class="input-group-btn">
								<button class="btn btn-default" type="button">
									<i class="fa fa-search" style="padding: 3px 0 3px 0;"></i>
								</button>
							</span>
						</div> <!-- /input-group -->
					</li>
					<li><a href="customer.action" class="active"><i
							class="fa fa-edit fa-fw"></i> 客户管理</a></li>
					<li><a href="salevisit.action"><i
							class="fa fa-dashboard fa-fw"></i> 客户拜访</a></li>
				</ul>
			</div>
			<!-- /.sidebar-collapse -->
		</div>
		<!-- /.navbar-static-side --> </nav>

		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-12">
					<h1 class="page-header">客户管理</h1>
				</div>
				<!-- /.col-lg-12 -->
			</div>
			<!-- /.row -->
			<div class="panel panel-default">
				<div class="panel-body">
					<form class="form-inline" action="$pageContext.request.contextPath /customer/list.action" method="get">
						<div class="form-group">
							<label for="customerName">客户名称</label> 
							<input type="text" class="form-control" id="customerName" value="$vo.custName " name="custName">
						</div>
						<div class="form-group">
							<label for="customerFrom">客户来源</label> 
							<select	class="form-control" id="customerFrom" placeholder="客户来源" name="custSource">
								<option value="">--请选择--</option>
								<c:forEach items="$fromType" var="item">
									<option value="$item.dict_id"<c:if test="$item.dict_id == vo.custSource"> selected</c:if>>$item.dict_item_name </option>
								</c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label for="custIndustry">所属行业</label> 
							<select	class="form-control" id="custIndustry"  name="custIndustry">
								<option value="">--请选择--</option>
								<c:forEach items="$industryType" var="item">
									<option value="$item.dict_id"<c:if test="$item.dict_id == vo.custIndustry"> selected</c:if>>$item.dict_item_name </option>
								</c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label for="custLevel">客户级别</label>
							<select	class="form-control" id="custLevel" name="custLevel">
								<option value="">--请选择--</option>
								<c:forEach items="$levelType" var="item">
									<option value="$item.dict_id"<c:if test="$item.dict_id == vo.custLevel"> selected</c:if>>$item.dict_item_name </option>
								</c:forEach>
							</select>
						</div>
						<button type="submit" class="btn btn-primary">查询</button>
					</form>
				</div>
			</div>
			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">客户信息列表</div>
						<!-- /.panel-heading -->
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>ID</th>
									<th>客户名称</th>
									<th>客户来源</th>
									<th>客户所属行业</th>
									<th>客户级别</th>
									<th>固定电话</th>
									<th>手机</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="$page.rows" var="row">
									<tr>
										<td>$row.cust_id</td>
										<td>$row.cust_name</td>
										<td>$row.cust_source</td>
										<td>$row.cust_industry</td>
										<td>$row.cust_level</td>
										<td>$row.cust_phone</td>
										<td>$row.cust_mobile</td>
										<td>
											<a href="#" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#customerEditDialog" onclick="editCustomer($row.cust_id)">修改</a>
											<a href="#" class="btn btn-danger btn-xs" onclick="deleteCustomer($row.cust_id)">删除</a>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<div class="col-md-12 text-right">
							<itcast:page url="$pageContext.request.contextPath /customer/list.action" />
						</div>
						<!-- /.panel-body -->
					</div>
					<!-- /.panel -->
				</div>
				<!-- /.col-lg-12 -->
			</div>
		</div>
		<!-- /#page-wrapper -->

	</div>
	<!-- 客户编辑对话框 -->
	<div class="modal fade" id="customerEditDialog" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">修改客户信息</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" id="edit_customer_form">
						<input type="hidden" id="edit_cust_id" name="cust_id"/>
						<div class="form-group">
							<label for="edit_customerName" class="col-sm-2 control-label">客户名称</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_customerName" placeholder="客户名称" name="cust_name">
							</div>
						</div>
						<div class="form-group">
							<label for="edit_customerFrom" style="float:left;padding:7px 15px 0 27px;">客户来源</label> 
							<div class="col-sm-10">
								<select	class="form-control" id="edit_customerFrom" placeholder="客户来源" name="cust_source">
									<option value="">--请选择--</option>
									<c:forEach items="$fromType" var="item">
										<option value="$item.dict_id"<c:if test="$item.dict_id == custSource"> selected</c:if>>$item.dict_item_name </option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="edit_custIndustry" style="float:left;padding:7px 15px 0 27px;">所属行业</label>
							<div class="col-sm-10"> 
								<select	class="form-control" id="edit_custIndustry"  name="cust_industry">
									<option value="">--请选择--</option>
									<c:forEach items="$industryType" var="item">
										<option value="$item.dict_id"<c:if test="$item.dict_id == custIndustry"> selected</c:if>>$item.dict_item_name </option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="edit_custLevel" style="float:left;padding:7px 15px 0 27px;">客户级别</label>
							<div class="col-sm-10">
								<select	class="form-control" id="edit_custLevel" name="cust_level">
									<option value="">--请选择--</option>
									<c:forEach items="$levelType" var="item">
										<option value="$item.dict_id"<c:if test="$item.dict_id == custLevel"> selected</c:if>>$item.dict_item_name </option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label for="edit_linkMan" class="col-sm-2 control-label">联系人</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_linkMan" placeholder="联系人" name="cust_linkman">
							</div>
						</div>
						<div class="form-group">
							<label for="edit_phone" class="col-sm-2 control-label">固定电话</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_phone" placeholder="固定电话" name="cust_phone">
							</div>
						</div>
						<div class="form-group">
							<label for="edit_mobile" class="col-sm-2 control-label">移动电话</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_mobile" placeholder="移动电话" name="cust_mobile">
							</div>
						</div>
						<div class="form-group">
							<label for="edit_zipcode" class="col-sm-2 control-label">邮政编码</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_zipcode" placeholder="邮政编码" name="cust_zipcode">
							</div>
						</div>
						<div class="form-group">
							<label for="edit_address" class="col-sm-2 control-label">联系地址</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" id="edit_address" placeholder="联系地址" name="cust_address">
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" onclick="updateCustomer()">保存修改</button>
				</div>
			</div>
		</div>
	</div>
	<!-- /#wrapper -->

	<!-- jQuery -->
	<script src="<%=basePath%>js/jquery.min.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="<%=basePath%>js/bootstrap.min.js"></script>

	<!-- Metis Menu Plugin JavaScript -->
	<script src="<%=basePath%>js/metisMenu.min.js"></script>

	<!-- DataTables JavaScript -->
	<script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
	<script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>

	<!-- Custom Theme JavaScript -->
	<script src="<%=basePath%>js/sb-admin-2.js"></script>
	
	<script type="text/javascript">
		function editCustomer(id) 
			$.ajax(
				type:"get",
				url:"<%=basePath%>customer/edit.action",
				data:"id":id,
				success:function(data) 
					$("#edit_cust_id").val(data.cust_id);
					$("#edit_customerName").val(data.cust_name);
					$("#edit_customerFrom").val(data.cust_source)
					$("#edit_custIndustry").val(data.cust_industry)
					$("#edit_custLevel").val(data.cust_level)
					$("#edit_linkMan").val(data.cust_linkman);
					$("#edit_phone").val(data.cust_phone);
					$("#edit_mobile").val(data.cust_mobile);
					$("#edit_zipcode").val(data.cust_zipcode);
					$("#edit_address").val(data.cust_address);
					
				
			);
		
		function updateCustomer() 
			$.post("<%=basePath%>customer/update.action",$("#edit_customer_form").serialize(),function(data)
				if(data == "0")
					alert("客户信息更新成功!");
				else
					alert("客户信息更新失败!");
				
				window.location.reload();
			);
		
		
		function deleteCustomer(id) 
			if(confirm(‘确实要删除该客户吗?‘)) 
				$.post("<%=basePath%>customer/delete.action","id":id,function(data)
					if(data == "0")
						alert("客户信息删除成功!");
					else
						alert("客户信息删除失败!");
					
					window.location.reload();
				);
			
		
	</script>

</body>

</html>

  

 

在自定义模板标签中解析 Django 自定义模板标签

】在自定义模板标签中解析Django自定义模板标签【英文标题】:ParsingaDjangocustomtemplatetagwithinacustomtemplatetag【发布时间】:2015-01-2005:21:01【问题描述】:我有一个有效的自定义模板标签。我想允许我的Django管理界面用户将该模板... 查看详情

php小工具自定义标签小部件标签云自定义标签云(代码片段)

查看详情

javaweb自定义标签

...标签库内的标签都满足不了需求,这时候就需要开发者自定义标签。 转http://www.cnblogs.com/vmax-tam/p/4145334.html自定义标签下面我们先来开发一个自定义标签,然后再说它的原理吧! 自定义标签的开发步骤 步骤一编写一... 查看详情

jsp自定义标签

概念自定义标签是用户定义的JSP语言元素。当JSP页面包含一个自定义标签时将被转化为servlet,标签转化为对被称为taghandler的对象的操作,即当servlet执行时Webcontainer调用那些操作。JSP标签扩展可以让你创建新的标签并且可以直接... 查看详情

jsp的自定义标签

...方标签库而言的,用来实现项目中特定的功能需求。2.自定义标签基本的组成部分①页面上看得见的部分[1]通过taglib引入标签库[2]标签本身②xxx.tld文件:用来注册标签处理器类③标签处理器类3.创建一个没有属性没有标签体的自... 查看详情

java_自定义标签,我的第一个自定义标签!(代码片段)

自定义标签,我的第一个自定义标签! 总共分两步编写一个实现tag接口的java类,把jsp页面中的java代码移到这个类中,(标签处理器类)编写标签库描述符(tld)文件,在tld文件中把标签处理器类描述成一个标签一.案例,    ... 查看详情

jsp自定义标签开放入门

JSP 自定义标签  自定义标签是用户定义的JSP语言元素。当JSP页面包含一个自定义标签时将被转化为servlet,标签转化为对被称为taghandler的对象的操作,即当servlet执行时Webcontainer调用那些操作。  JSP标签扩展可以让你创建... 查看详情

如何创建自定义标签栏...在标签栏中添加自定义图像(无需 xib 更改)

】如何创建自定义标签栏...在标签栏中添加自定义图像(无需xib更改)【英文标题】:howcanicreatecustomtabbar...addcustomimagesintabbar(withoutxibchanges)【发布时间】:2011-01-1705:37:17【问题描述】:我在该标签栏中有一个应用程序是自定义... 查看详情

jsp2自定义标签开篇

在JSP2中开发标签库需要以下几个步骤:1.开发自定义标签处理类;2.建立一个*.tld文件,每个*.tld文件对应一个标签库,每个标签库可包含多个标签;3.在JSP文件中使用自定义标签。第一步骤:开发自定义标签类。标签类需要继承j... 查看详情

javajsp自定义标签

1 自定义标签1.1引入需求:向浏览器输出当前客户的IP地址(只能使用jsp标签) 1.2第一个自定义标签开发步骤1)编写一个普通的java类,继承SimpleTagSupport类,叫标签处理器类 /** *标签处理器类 *@author APPle&nbs... 查看详情

iPhone X 自定义标签栏问题

】iPhoneX自定义标签栏问题【英文标题】:iPhoneXcustomtabbarissue【发布时间】:2017-10-3007:12:17【问题描述】:我们的应用中有自定义标签栏。自定义标签栏的高度是固定的。它适用于除iPhoneX之外的所有设备。问题是自定义标签栏的... 查看详情

r语言ggplot2可视化自定义图例标签间距实战:自定义图例标签间距自定义图例与图像之间的间距

R语言ggplot2可视化自定义图例标签间距实战:自定义图例标签间距、自定义图例与图像之间的间距目录 查看详情

自定义标签(代码片段)

自定义标签在JSP开发中,为了处理某些逻辑功能,难免会在JSP页面书写大量的Java代码,从而导致JSP页面难以维护,可用性较低,为此,JSP从版本1.1开始,支持用户开发自己的标签,即自定义标签。... 查看详情

07java--jsp自定义标签(代码片段)

自定义标签自定义标签自定义标签主要用于移除Jsp页面中的java代码。在JSP中使用自定义标签的开发步骤如下:开发一个对应的Java类。配置这个Java类,使它成为一个标签。使用tablib指令引入。编写一个实现Tag接口的Java类(标签... 查看详情

自定义标签

...et.jsp.tagext.JspTag,它是所有的标签的根接口。在jsp2.0以后,定义了一个更加简单的javax.servlet.jsp.tagext.SimpleTag,这个接口就描述了如何自定义标签。标签的分类:传统标签简单标签SimpleTagSimpl 查看详情

自定义jsp标签(代码片段)

1、标签库的运作离不开tld文件2、标签库的标签是定义在tld中的tag标签内(助手类)标签的语言特点 <开始标签属性="属性值">标签体</结束标签>3.自定义标签的开发及使用步骤3.1创建一个标签助手类(继承BodyTagSupport)... 查看详情

自定义标签

一、创建自定义标签基本步骤1、步骤标签处理类(标签也是一个对象,那么就需要先有类!)tld文件,它是一个xml页面中使用<%@taglib%>来指定tld文件的位置2、标签处理类SimpleTag接口voiddoTag():每次执行标签时都会调用这个方... 查看详情

jsp自定义标签开发入门

一般情况下开发jsp自定义标签需要引用以下两个包importjavax.servlet.jsp.*;importjavax.servlet.jsp.tagext.*;首先我们需要大致了解开发自定义标签所涉及到的接口与类的层次结构(其中SimpleTag接口与SimpleTagSupport类是JSP2.0中新引入的)。目标1:... 查看详情