- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个页面editpatent.jsp,其中包含一个页面patentlist.jsp。当您运行 editpatent.jsp 时,它会显示数据库中存在的所有记录。我有一个下拉列表和一个搜索字段来指定搜索。因此,当我运行 editPatent.jsp 时,它会以存储在数据库中的方式显示所有记录。所以我想根据名称和显示对其进行排序。所以请告诉我如何做同样的事情。当您点击姓名、电子邮件或城市时,它会相应地排序
病人列表.jsp
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="DB.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
.evenRow{
height: 50px;
background-color: white;
text-transform: none;
text-shadow: none;
color: black;
}
.evenRow:hover
{
background-color: #C2FEF0;
}
.row{
height: 50px;
background-color: #E4E6E6;
text-transform: none;
text-shadow: none;
color: black;
}
.row:hover {
background-color: #C2FEF0;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<table style="border-collapse: collapse;overflow-x: scroll; width:97%">
<tr style="background-color:grey;height:50px">
<th style="min-width: 100px">
NAME
</th>
<th style="min-width: 100px">
CITY
</th>
<th style="min-width: 100px">
LAST VISIT
</th>
<th style="min-width: 100px">
MOBILE
</th>
<th style="min-width: 100px">
EMAIL
</th>
<th style="min-width: 100px">
STATUS
</th>
<th style="min-width: 100px">
VIEW
</th>
<th style="min-width: 100px">
EDIT
</th>
</tr>
<%
DataBaseConnection db = new DataBaseConnection();
Connection con = db.connet();
PreparedStatement pt = con
.prepareStatement("select * from Patient");
ResultSet rs = pt.executeQuery();
String searchBy = request.getParameter("searchBy");
String searchElement = request.getParameter("searchElement");
int count = 0;
int index = -1;
boolean name = false;
if ("city".equalsIgnoreCase(searchBy))
index = 9;//change the index to the index of the city
else if ("firstName".equalsIgnoreCase(searchBy))
index = 1;
else if ("lastName".equalsIgnoreCase(searchBy))
index = 2;
else if ("name".equalsIgnoreCase(searchBy)) {
index = 1;
name = true;
}
while (rs.next()) {
if (searchElement == null
|| ((searchElement.equals(rs.getString(index)) && !name) || (name && searchElement
.equalsIgnoreCase(rs.getString(index) + " "
+ rs.getString(index + 1))))) {
if (count++ % 2 == 0) {
%>
<tr class="evenRow" >
<td>
<%=rs.getString(1)%>
</td>
<td>
<%=rs.getString(2)%>
</td>
<td>
<%=rs.getString(3)%>
</td>
<td>
<%=rs.getString(4)%>
</td>
<td>
<%=rs.getString(5)%>
</td>
<td>
<%=rs.getString(6)%>
</td>
<td>
<form action="getPatientDetails.jsp"><input type="hidden" name="hidden" value="<%=count%>"/><input type="submit" value="view"></form>
</td>
<td>
<a onclick="renderEdit(<%out.println("edit");%>)"><%
out.println("edit");
%></a>
</td>
</tr>
<%
} else {
%>
<tr class="row">
<td>
<%=rs.getString(1)%>
</td>
<td>
<%=rs.getString(2)%>
</td>
<td>
<%=rs.getString(3)%>
</td>
<td>
<%=rs.getString(4)%>
</td>
<td>
<%=rs.getString(5)%>
</td>
<td>
<%=rs.getString(6)%>
</td>
<td>
<a onclick="renderView(<%out.println("view");%>)"><%
out.println("view");
%></a>
</td>
<td>
<a onclick="renderEdit(<%out.println("edit");%>)"><%
out.println("edit");
%></a>
</td>
</tr>
<%
}
}
}
%>
</table>
</body>
</html>
编辑病人.jsp
<%@ page import="java.util.*" %>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<script type="text/javascript">
var request;
function getRequestObject()
{
if (window.ActiveXObject)
{
return(new ActiveXObject("Microsoft.XMLHTTP"));
}
else if (window.XMLHttpRequest)
{
return(new XMLHttpRequest());
}
else {
return(null);
}
}
function sendRequest()
{
request = getRequestObject();
request.onreadystatechange = handleResponse;
var address = "patientList.jsp?searchBy=" + document.getElementById("searchBy").value + "&searchElement="+ document.getElementById("searchElement").value;
request.open("GET", address, true);
request.send(null);
}
function handleResponse()
{
if (request.readyState == 4 && request.status == 200)
{
document.getElementById("table").innerHTML = request.responseText;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Edit Patient</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<form id="f1" name="f1" method="post" onsubmit="ccheck();" >
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
<section id="page" > <!-- Defining the #page section with the section tag -->
<header > <!-- Defining the header section of the page with the appropriate tag -->
<hgroup align="center">
<h3>Edit Patient</h3>
</hgroup>
</header>
<section id="articles"> <!-- A new section with the articles -->
<!-- Article 1 start -->
<div class="line"></div> <!-- Dividing line -->
<article id="article1"> <!-- The new article tag. The id is supplied so it can be scrolled into view. -->
<div class="articleBody clear">
search:
<select id="searchBy">
<option value="lastName">Last Name</option>
<option value="firstName">First Name</option>
<option value="name">Name</option>
<option value="city">City</option>
</select>
<input id="searchElement"/>
<input type="button" value="Search" onclick="sendRequest();"/>
</div>
</article>
<div id="table" align="center">
<jsp:include page="patientList.jsp" />
</div>
</article>
</section>
<footer> <!-- Marking the footer section -->
<div class="line"></div>
<a href="#" class="up">Go UP</a>
</footer>
</section> <!-- Closing the #page section -->
<!-- JavaScript Includes -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="jquery.scrollTo-1.4.2/jquery.scrollTo-min.js"></script>
<script src="script.js"></script>
</form>
</body>
</html>
最佳答案
看看这个链接是否对您有帮助。
http://tympanus.net/codrops/2009/10/03/33-javascript-solutions-for-sorting-tables/
http://www.allmyscripts.com/Table_Sort/
如果您已经尝试过任何操作,请告诉我们
关于java - 如何在jsp页面中根据名字显示名字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16161089/
古今中外,人其实最珍惜自己的姓名,分量可谓举足轻重,几乎构成一个人最重要的人生价值载体,同理,一个网站的标题也就像网站的名字一样,标题的定性决定着这个网站的路怎么走,SEO的工作将会围绕着这些进行展
我需要强制执行 LASTNAME/FIRSTNAME Something like Smith/John 这种模式。 字符可以是字母数字(小写/大写)也包括特殊字符,如 ë 等。 图案: 基本上规
我有两个字段:first 和 last 我正在尝试使用 multi_match模糊匹配全名: "multi_match": { "query": name, "fields": [
国王i | 王妃i 青梅。 | 竹马。 我要逆天 | 我要爆炸 以前呢i | 后来呢i 抱紧我i | 深吻我i 心悦 | 钟意 依赖 | 共生 阿怪i | 阿乖i 花岛丶 | 草浅丶
我是Delphi的新手。每次运行事物时,都会出现此错误: adoquery1:未找到参数“名字” procedure TForm1.Button1Click(Sender: TObject); beg
我是 Akka 新手,我正在尝试制作一个简单的项目,即有鱼的水族馆。问题是我不知道如何获取我在这一行中声明的 Actor 的名字 final ActorRef fish1 = system.actor
以下是要求:我。如果有名字、中间名和姓氏,则仅显示名字和姓氏二.如果有第一个和最后一个,则显示第一个和最后一个三.如果只有名字,则直接显示 我有以下代码: String fullName = "fir
我使用此 PHP 正则表达式来检查字段是否包含名称(至少包含名字/姓氏,然后是可选的其他中间名或缩写)的 true/false。 $success = preg_match("/([\x{00c0}-
当使用 django allauth 进行社交帐户注册时,allauth 自动将用户名定义为从 3rdparty 获取的 first_name。因此,例如:如果 facebooks John Cucu
我想尝试在 Javascript 中检测一个人名字的不同部分,并将它们剪掉,以便我可以将它们传递给其他东西。 名称可以以任何格式出现——例如:- 维多利亚·米·莱恩小姐 Victoria C J Lo
这是我读过的教程中的查询 CREATE TABLE Employee ( id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, depa
我从包含用户名的文本框中输入了用户输入 输入可以如下所示: var input = "Doe, John M"; 但是,输入可能要复杂得多。像: var input = "Doe Sr, John M
在 Javascript 中,我尝试将全名(名字、中间名和姓氏)输入到字段中,单击提交按钮后将输出到三个单独的字段:字符长度、中间名和 3缩写。到目前为止,我已经到达字符字段,但我对如何获取两个空格之
我尝试通过 java 解析 XML DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder
formatName 方法应该接受名为 name 的字符串,其中包含格式为“First Last”的名称。你可能会认为字符串中只有一个空格。该方法应该创建并返回一个包含名称的字符串格式为“最后,第一个
我是 node.js 的新手。我正在尝试创建一个注册页面并使用 mysql 将输入的值保存在数据库中。 我可以通过在请求 header 上传递参数来做到这一点。但是,在请求 header 中传递参数始
我需要一个函数来根据以下字段检查重复条目:first_name、last_name 和 tel我尝试过浏览论坛,但似乎找不到帮助。 prepare($sql); $stmt->bind_param('
我有下表: First Name Bryce Marcellin Caroline Kerry Roberto Mary Carol Warren Bonnie Terry L
所以我制作了一个代码让用户输入他们的名字和姓氏;然后交换两个位置。 例如。 Bulota Babi 成为 Babi, Bulota 这是我的代码 public class trial { pu
我想知道你是否有两列让我们说 first name. last name. 您在数据库中存储的内容。 您能否在数据库中创建一个“动态”列“全名”,自动根据名字和姓氏创建姓名? firstname
我是一名优秀的程序员,十分优秀!