index.jsp

 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%> <!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">
<title>账单管理</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<style>
table{width:700px;}
table ,tr ,td, th
{
text-align: center;
border:1px black solid;
border-collapse:collapse;
}
.setGreen{background-color: green;}
.over{background-color:#f9360d;}
span{font-weigh:bold;color:red;}
</style>
<script>
function setTableColor()
{
var table = $("#showTable")[0];
for(var i = 0; i < table.rows.length; i++)
{
if(i % 2 == 0)
{
table.rows[i].className = "setGreen";
}
var name;
table.rows[i].onmouseover = function()
{
name = this.className;
this.className = "over";
}
table.rows[i].onmouseout = function()
{
this.className = name;
}
}
}
$(
function loadType()
{
var select = $("#bookClass");
select.html("<option value='0'>不限</option>");
$.ajax
({
url:"type_query",
type:"post",
dataType:"json",
success:function(data)
{
var types = data.typeList;
for(var i = 0; i < types.length; i++)
{
var option = "<option value='"+types[i].id+"'>"+types[i].name+"</option>";
select.append(option);
}
},
error:function()
{
alert("服务器忙!");
}
});
}
);
function checkTime(timeInput)
{
var time = timeInput.value;
var regTime = /^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;
var error = $("#error");
error.html("");
if(regTime.test(time) || time == "")
{
return true;
}
error.html("日期格式不正确!(yyyy-MM-dd)");
return false;
}
function checkAll()
{
if(checkTime($("#begintime")[0]) && checkTime($("#endtime")[0]))
{
return true;
}
return false;
}
</script>
</head>
<body>
<div align="center">
<h1>账单管理系统</h1>
<form action="bill_query" method="post" onsubmit="return checkAll();">
类型:<select id="bookClass" name="typeid"></select>&nbsp;
时间:<input type="text" id="begintime" name="begintime" onblur="checkTime(this);" />&nbsp;到&nbsp;
<input type="text" id="endtime" name="endtime" onblur="checkTime(this);" />&nbsp;
<input type="submit" id="query" value="搜索" onclick="query(1,10);" />
<input type="button" value="记账" onclick="javascript:window.location='record.jsp'" /></br>
</br></form>
<table id="showTable">
<tr><th>行号</th><th>标题</th><th>记账时间</th><th>类别</th><th>金额</th><th>说明</th></tr>
<c:forEach items="${billList}" var="each" varStatus="status">
<tr>
<td>${status.count}</td>
<td>${each.title}</td>
<td>${each.billtime}</td>
<td>
<c:forEach items="${typeList}" var="type">
<c:if test="${each.typeid == type.id}">
${type.name}
</c:if>
</c:forEach>
</td>
<td>${each.price}</td>
<td>${each.remark}</td>
</tr>
</c:forEach>
<c:if test="${billList == null || fn:length(billList) == 0}">
<tr><td colspan="6"><h3>没有查到任何数据!</h3></td></tr>
</c:if>
<c:if test="true">
<script>setTableColor();</script>
</c:if>
</table>
<span><h3 id="error"></h3></span>
</div>
</body>
</html>

JSTL分类查询的更多相关文章

  1. SQL 语句与性能之联合查询和联合分类查询

    select * from t1 left join t2 on t2.sysno =t1.ASysNo left join t3 on t3.sysno =t2.ASysNo left join t ...

  2. SQL-三级分类查询

    /*SQLyog 企业版 - MySQL GUI v8.14 MySQL - 5.5.40 : Database - appinfodb******************************** ...

  3. php实现无限级分类查询(递归、非递归)

    递归函数实现方式 上面提到,递归函数的也是借助于栈的机制实现的,但是底层对于栈的处理对于程序员来说都是透明的,程序员只需要关心应用的实现逻辑.所以说使用递归处理上述问题理解起来比较容易,代码也比较简洁 ...

  4. 最基础的PHP分类查询程序

    最初级的PHP分类查询程序 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http ...

  5. 阶段5 3.微服务项目【学成在线】_day07 课程管理实战_03-新增课程-课程分类查询

    2 新增课程 2.1 需求分析 用户操作流程如下: 1.用户进入“我的课程”页面,点击“新增课程”,进入新增课程页面 2.填写课程信息,选择课程分类.课程等级.学习模式等. 3.信息填写完毕,点击“提 ...

  6. 用Django实现Video页面分类查询

    Model表创建,Url映射,Views函数处理,Html生成 根据上图,视频方向与视频分类是多对多的关系,视频分类与视频信息是一对多的关系,难度级别是单一的查询条件(与之前俩者并无关系) Model ...

  7. MySQL 获取某一个分类ID的所有父或子分类查询结果

    创建一个自定义函数: ; DELIMITER $$ USE `dressv_website`$$ DROP FUNCTION IF EXISTS `fn_QueryRelation`$$ CREATE ...

  8. ThinkPHP分类查询(获取当前分类的子分类,获取父分类,下一级分类)

    获取指定分类的所有子分类ID号 //获取指定分类的所有子分类ID号 function getAllChildcateIds($categoryID){ //初始化ID数组 $array[] = $ca ...

  9. 利用JSTL重写查询的jsp页面

    利用JSTL重写Java Web MVC实例中的jsp页面 第一步:导入jstl.jar和standard.jar文件

随机推荐

  1. Java线程中run和start方法的区别

    http://bbs.csdn.net/topics/350206340 Thread类中run()和start()方法的区别如下:run()方法:在本线程内调用该Runnable对象的run()方法 ...

  2. eclipse下环境变量设置:eclipse导入工程出现 Unbound classpath variable Error

    在导入网友提供的Tomcat源码工程时候出现了 The project cannot be build until build path errors are resolved Unbound cla ...

  3. Spring学习8- SSH需要的jar包

    struts2 commons-logging-1.0.4.jar 主要用于日志处理 freemarker-2.3.8.jar 模板相关操作需要包 ognl-2.6.11.jar ognl表达示所需包 ...

  4. redis安装步骤

    7.1创建业务安装用户 安装和配置Redis软件时,需要使用redis用户登录服务器进行相关操作,因此需要创建redis的业务安装用户组和redis的业务安装用户.此操作在主备机上同时进行. 创建用户 ...

  5. easyUI框架之学习2--添加左侧导航栏

    <head> function addTab(title, url) { if ($('#tableContainer').tabs('exists', title)) { $('#tab ...

  6. hdu 1205 吃糖果

    思路: 仔细想想,想要不重复吃一种糖果, 把所有糖果吃完,只要所有糖果的和,减去最多的糖果+1>=最多糖果的数量即可不重复吃完. #include <stdio.h> int mai ...

  7. static NSString *ID的改进

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa ...

  8. memcache的内存回收机制

    memcache不会释放内存,而是重新利用. 在缓存的清除方面,memcache是不释放已分配内存.当已分配的内存所在的记录失效后,这段以往的内存空间,memcache只会重复利用. memcache ...

  9. Starting zabbix_agentd: No such file or directory

    问题描述 [root@localhost admin]# service zabbix_agentd restart Shutting down zabbix_agentd: [FAILED] Sta ...

  10. user32.dll

    user32.dll中的所有函数 using System; using System.Collections.Generic; using System.Linq; using System.Tex ...