📄 20229c47ef12001b13c6d61302193387
字号:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://ajaxtags.org/tags/ajax" prefix="ajax"%>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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 http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>AJAX JSP Tag Library Example</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/prototype-1.4.0.js"></script>
<script type="text/javascript" src="js/scriptaculous.js"></script>
<script type="text/javascript" src="js/overlibmws.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/ajaxtags-1.2-beta2.js"></script>
<link rel="stylesheet" type="text/css" href="css/ajaxtags.css" />
<link rel="stylesheet" type="text/css" href="css/displaytag.css" />
</head>
<body>
<c:set var="contextPath" scope="request">${pageContext.request.contextPath}</c:set>
<div id="header">AJAX JSP Tag Library Example</div>
<div id="content">
<h1>Autocomplete</h1>
<div style="margin-top: 0px; padding-top: 0px; font-size: 70%">
<a href="${contextPath}/txt/jsp/autocomplete.jsp.txt">JSP source</a>
| <a href="${contextPath}/src/org/ajaxtags/demo/servlet/AutocompleteServlet.java">Java source</a>
</div>
<div style="font-size: 90%; width: 650px;">
<p>
The <code>ajax:autocomplete</code> tag allows one to retrieve a list of probable values from a
backend servlet (or other server-side control) and display them in a dropdown beneath an HTML
text input field.
</p>
<p>
The user may then use the cursor and ENTER keys or the mouse to make a selection from that list
of labels, which is then populated into the text field. This JSP tag also allows for a second
field to be populated with the value or ID of the item in the dropdown.
</p>
<p>
You'll notice that an image is used to indicate a busy state while the XMLHttpRequest object is
making it's request to the server-side. This is a bit of JavaScript/CSS trickery--check the
source to see how it's done.
</p>
</div>
<form action="." class="basicForm">
<fieldset>
<legend>Enter Car Model</legend>
<p>Available values start with letters: 'A', 'C', 'E', 'F', 'M', 'R', 'T'</p>
<label for="model">Name:</label>
<input id="model" name="model" type="text" size="30" />
<span id="indicator" style="display:none;"><img src="${contextPath}/img/indicator.gif" /></span>
<label for="make">Make:</label>
<input id="make" name="make" type="text" size="30" />
</fieldset>
</form>
<div id="errorMsg" style="display:none;border:1px solid #e00;background-color:#fee;padding:2px;margin-top:8px;width:300px;font:normal 12px Arial;color:#900"></div>
<ajax:autocomplete
source="model"
target="make"
baseUrl="${contextPath}/autocomplete.view"
className="autocomplete"
indicator="indicator"
minimumCharacters="1"
parser="new ResponseXmlToHtmlListParser()" />
<jsp:useBean id="now" class="java.util.Date"/>
<p>
Page loaded at: ${now}
</p>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -