java自定义标签代码

--------------------javaBean---------------
AuditingMSSqlIMp.java文件
public Page getAuditingListPage(int pageIndex, int pageSize,int userId) throws SQLException {
// TODO Auto-generated method stub
Page page = new Page();
Connection conn = null;
CallableStatement stmt = null;
ResultSet rst = null;
try{
String str="{call dbo.up_auditingList(?,?,?)}";
conn = super.getDBConnection();
stmt = conn.prepareCall(str);
stmt.setInt(1, pageIndex);
stmt.setInt(2, pageSize);
stmt.setInt(3, userId);
rst = stmt.executeQuery();
while(rst.next()){
LpReadObj auditing = new LpReadObj();
auditing.setRegionName(rst.getString("regionName"));
auditing.setRealName(rst.getString("realName"));
auditing.setUserName(rst.getString("userName"));
auditing.setApplyLpCount(rst.getInt("Ah_applyLpcount"));
auditing.setApprovalCount(rst.getInt("ah_approvalCount"));
auditing.setType(rst.getInt("ah_type"));
auditing.setApplyDate(rst.getString("ah_applydate"));
page.getItems().add(auditing);

}
if (stmt.getMoreResults()) {
rst = stmt.getResultSet();
if (rst.next()) {
page.setTotalRecords(rst.getInt(1));
}
}
}catch (SQLException e) {
throw e;
}finally{
super.closeResultSet(rst);
super.closeStatement(stmt);
super.closeConnection(conn);
}
return page;
}
--------------------页面使用文件---------------
auditing_Query.jsp 页面使用文件

<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%@ page import="com.eline.epicc.user.*"%>
<%@ page import="com.eline.epicc.user.model.*"%>
<%@ taglib uri="/tlds/eline-common.tld" prefix="common1"%>
<%@ taglib uri="/tlds/eline-auditing.tld" prefix="auditing1"%>
<%
User user = Users.getUser();
if (user == null || user.getUserId() == 0) {
System.out.println("Can not get instance of current user.");
user = Users.getAnonymousUser();
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<auditing1:auditingListQuery id="auditingList1" userId="<%=user.getUserId()%>" pageSize="10">
<table class="clsDataList" cellspacing="0" width="100%" border="1" cellpadding="1">
<tr height="30">
<th align="center" nowrap width="12%">分公司</th>
<th align="center" nowrap width="10%">真实姓名</th>
<th align="center" nowrap width="10%">登陆名称</th>
<th align="center" nowrap width="4%">申请号码数</th>
<th align="center" nowrap width="4%">批准号码数</th>
<th align="center" nowrap width="5%">二维码类型</th>
<th align="center" nowrap width="10%">批复日期</th>
</tr>
<common1:items>
<tr height="25">
<td align="center" width="12%"><auditing1:auditingQueryAttribute name="regionName" /></td>
<td align="center" width="10%"><auditing1:auditingQueryAttribute name="realName" /></td>
<td align="center" width="10%"><auditing1:auditingQueryAttribute name="userName" /></td>
<td align="center" width="4%"><auditing1:auditingQueryAttribute name="applyLpCount" /></td>
<td align="center" width="4%"><auditing1:auditingQueryAttribute name="approvalCount" /></td>
<td align="center" width="5%"><auditing1:auditingQueryAttribute name="type" /></td>
<td align="center" width="10%"><auditing1:auditingQueryAttribute name="applyDate" /></td>
</tr>
</common1:items>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><common1:summaryForm /></td>
<td align="right">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><common1:numberForm>
<input type="submit" value="GO"
style="HEIGHT: 20px; FONT-FAMILY:SimSun" />
</common1:numberForm></td>
<td valign="bottom"><common1:firstForm>
<input class="clsBtnPager" type="submit" value="7">
</common1:firstForm></td>
<td valign="bottom"><common1:prevForm>
<input class="clsBtnPager" type="submit" value="3">
</common1:prevForm></td>
<td valign="bottom"><common1:nextForm>
<input class="clsBtnPager" type="submit" value="4">
</common1:nextForm></td>
<td valign="bottom"><common1:lastForm>
<input class="clsBtnPager" type="submit" value="8">
</common1:lastForm></td>
</tr>
</table>
</td>
</tr>
</table>
</auditing1:auditingListQuery>
--------------------配置页面使用的属性---------------
package com.eline.epicc.auditing.taglib;
import org.blue.util.StringUtils;
import com.eline.epicc.auditing.model.LpReadObj;
import com.eline.epicc.insurance.Insurances;
import com.eline.epicc.taglib.ItemAttributeTag;
public class AuditingQueryAttributeTag extends ItemAttributeTag {

/**
*
*/
private static final long serialVersionUID = 1L;
protected String createText() {
LpReadObj obj = (LpReadObj) item;
if (name.equalsIgnoreCase("regionName")) {
return "" + obj.getRegionName();
} else if (name.equalsIgnoreCase("userName")) {
return "" + obj.getUserName();
}else if (name.equalsIgnoreCase("realName")) {
return "" + obj.getRealName();
}else if(name.equalsIgnoreCase("mobilePIN")){
return "" + StringUtils.toString(obj.getMobilePIN());
}else if(name.equalsIgnoreCase("applyLpCount")){
return "" + StringUtils.toString(obj.getApplyLpCount());
}else if(name.equalsIgnoreCase("approvalCount")){
return "" + StringUtils.toString(obj.getApprovalCount());
}else if(name.equalsIgnoreCase("type")){
return "" + Insurances.getTypeMessage(obj.getType());
}else if(name.equalsIgnoreCase("applyDate")){
String aa = StringUtils.toString(obj.getApplyDate());
String bb = aa.substring(0, 11);
return "" + bb;

}
return null;
}
}


--------------------配置标签使用类---------------
package com.eline.epicc.auditing.taglib;

import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import com.eline.epicc.auditing.Auditings;
import com.eline.epicc.taglib.ListTag;
import com.eline.epicc.taglib.SortOrder;
import com.eline.epicc.user.Users;
import com.eline.epicc.user.model.SortUsersBy;
import com.eline.epicc.user.model.User;
import com.eline.epicc.taglib.Page;

public class AuditingQueryTag extends ListTag {
/**
*
*/
private static final long serialVersionUID = 1L;
protected final String prefix = "UserList_";
protected boolean hasNext = false;
private String regionName;//分公司
private String userName;//姓名
private String realName;
private int userId;
protected int sortBy = SortUsersBy.Username;
protected int sortOrder = SortOrder.Ascending;
protected String usernameFilter = null;
private int tatalCount;
private int doneCount;
private int remainCount;
private int unApplyCount;
private int approvalCount;
private int type;

//审核记录
private String mobilePIN;//TEL
private int applyLpCount;//applyCount
private String applyDate; //审核日期
public String getApplyDate() {
return applyDate;
}
@Override
protected Collection findCollection() throws Exception {
// TODO Auto-generated method stub
Collection coll = null;
Page page = null;

User user = Users.getUser();
if (user == null || user.getUserId() == 0)
throw new Exception("Can not get instance of current user.");

HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

// 保证每次调用该列表页面时总显示第一页
if (request.getParameter(getParamPrefix() + "pageIndex") == null
|| request.getParameter(super.getParamPrefix() + "pageIndex").equals("")
|| request.getParameter(getParamPrefix() + "pageIndex").equalsIgnoreCase("null"))
pageIndex = 0;
page = Auditings.readAuditingList(pageIndex,pageSize,user.getUserId());
coll = page.getItems();
System.out.println("page.size()=" + page.getSize());

// 为基类相应属性赋值,写共几条记录,共几页第几页用
totalRecords = page.getTotalRecords(); // 共有多少条记录
//totalRecords = 5;
totalPages = (totalRecords + pageSize - 1) / pageSize; // 共有多少页
// 是否有下页
hasNext = ((pageIndex + 1) < totalRecords) ? true : false;
return coll;
}

@Override
protected void initParamPrefix() {
super.paramPrefix = this.prefix;
}

public void setUsernameFilter(String usernameFilter) {
if (usernameFilter != null
&& (usernameFilter.length() == 0 || usernameFilter.equalsIgnoreCase("null")))
this.usernameFilter = null;
else
this.usernameFilter = usernameFilter;
}
@Override
protected boolean needsNextForm() {
// TODO Auto-generated method stub
return hasNext;
}

}

--------------------页面属性配置文件---------------
eline-auditing.tld文件 自定义标签配置属性文件
<?xml version="1.0" encoding="GB2312"?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<!-- a tag library descriptor -->
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>waftemplate</shortname>
<uri></uri>
<info>EPicc Web Application Framework Template Tags</info>

<!--
二维码列表显示
-->
<tag>
<name>auditingAttribute</name>
<tagclass>com.eline.epicc.auditing.taglib.AuditingAttributeTag</tagclass>
<bodycontent>empty</bodycontent>
<info>用于二维码分配的详细信息</info>

<!-- default is "name" -->
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

<tag>
<name>auditingQueryAttribute</name>
<tagclass>com.eline.epicc.auditing.taglib.AuditingQueryAttributeTag</tagclass>
<bodycontent>empty</bodycontent>
<info>用于二维码分配的详细信息</info>

<!-- default is "name" -->
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>auditingListQuery</name>
<tagclass>com.eline.epicc.auditing.taglib.AuditingQueryTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>用于求出符合条件的二维码信息列表</info>

<!-- id字符串 -->
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>userId</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<!-- 每页最大记录数 -->
<attribute>
<name>pageSize</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<!-- 第几页 -->
<attribute>
<name>pageIndex</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<!-- 排序字段 -->
<attribute>
<name>sortBy</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>sortOrder</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- 分公司 -->
<attribute>
<name>regionName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- (手机)姓名 -->
<attribute>
<name>userName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- 姓名 -->
<attribute>
<name>realName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- 电话号码 -->
<attribute>
<name>mobilePIN</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<!-- 申请号码数-->
<attribute>
<name>applyLpCount</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!-- 批准号码数-->
<attribute>
<name>approvalCount</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!--二维码类型-->
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<!--审核日期-->
<attribute>
<name>applyDate</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
--------------------以上流程自定义标签实现---------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
GeoPandas是一个开源的Python库,旨在简化地理空间数据的处理和分析。它结合了Pandas和Shapely的能力,为Python用户提供了一个强大而灵活的工具来处理地理空间数据。以下是关于GeoPandas的详细介绍: 一、GeoPandas的基本概念 1. 定义 GeoPandas是建立在Pandas和Shapely之上的一个Python库,用于处理和分析地理空间数据。 它扩展了Pandas的DataFrame和Series数据结构,允许在其中存储和操作地理空间几何图形。 2. 核心数据结构 GeoDataFrame:GeoPandas的核心数据结构,是Pandas DataFrame的扩展。它包含一个或多个列,其中至少一列是几何列(geometry column),用于存储地理空间几何图形(如点、线、多边形等)。 GeoSeries:GeoPandas中的另一个重要数据结构,类似于Pandas的Series,但用于存储几何图形序列。 二、GeoPandas的功能特性 1. 读取和写入多种地理空间数据格式 GeoPandas支持读取和写入多种常见的地理空间数据格式,包括Shapefile、GeoJSON、PostGIS、KML等。这使得用户可以轻松地从各种数据源中加载地理空间数据,并将处理后的数据保存为所需的格式。 2. 地理空间几何图形的创建、编辑和分析 GeoPandas允许用户创建、编辑和分析地理空间几何图形,包括点、线、多边形等。它提供了丰富的空间操作函数,如缓冲区分析、交集、并集、差集等,使得用户可以方便地进行地理空间数据分析。 3. 数据可视化 GeoPandas内置了数据可视化功能,可以绘制地理空间数据的地图。用户可以使用matplotlib等库来进一步定制地图的样式和布局。 4. 空间连接和空间索引 GeoPandas支持空间连接操作,可以将两个GeoDataFrame按照空间关系(如相交、包含等)进行连接。此外,它还支持空间索引,可以提高地理空间数据查询的效率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值