我需要帮助在Netbeans中实现MySQL数据库。
基本上,我有两个数据库 - 一个叫做Words,有5,014个不同的单词,一个叫做定义,所有单词定义都在。
我已经在NetBeans的下拉列表中实现了Words数据库,因此它显示了所有5,014个单词,但我对如何实现其他数据库感到困惑,以便当用户点击时,例如“Abandon”和在提交按钮中,生成的定义页面将仅显示放弃的定义,我在定义数据库中有。
这是我的首页代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Online English Dictionary</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1 align="center">Hello and welcome to my Online English Dictionary</h1>
<table align="center">
<thead>
<tr>
<th>This Online English Dictionary uses a 5,000 word list
compiled by Professor Mark Davies of Brigham Young University
in Provo, Utah.</th>
</tr>
</thead>
<tbody>
<tr>
<td>To view a definition of a particular word, please select
from the list below.</td>
</tr>
<tr>
<td>
<form action="submit.jsp">
<strong>Select a word:</strong>
<select name="word_id">
<c:forEach var="row" items="${words.rowsByIndex}">
<option><c:out value="${row[1]}"/></option>
</c:forEach>
</select>
<input type="submit" value="submit" name="submit" />
</form>
</td>
</tr>
</tbody>
</table>
</body>
虽然这是创建我的定义数据库的代码:
DROP TABLE IF EXISTS Definition;
CREATE TABLE Definition (
definition_id SMALLINT,
definition VARCHAR (2500),
word_id VARCHAR (17),
PRIMARY KEY (definition_id),
FOREIGN KEY (word_id) REFERENCES Words(word_id)
);
INSERT INTO Definition (definition)
VALUES ('1. The first letter of the modern English alphabet.
2. Any of the speech sounds represented by the letter a.
3. The first in a series.
4. Something shaped like the letter A.
5. A The best or highest in quality or rank: grade A milk.
6. Music
a. The sixth tone in the scale of C major or the first tone in the relative minor scale.
b. A key or scale in which A is the tonic.
c. A written or printed note representing this tone.
d. A string, key, or pipe tuned to the pitch of this tone.
7. A One of the four major blood groups in the ABO system. Individuals with this blood group have the A antigen on the surface of their red blood cells, and the anti-B antibody in their blood serum.'),
('vb (tr)
1. to forsake completely; desert; leave behind: to abandon a baby; drivers had to abandon their cars.
2. (Nautical Terms) abandon ship the order given to the crew of a ship that is about to sink to take to the lifeboats
3. to give up completely: to abandon a habit; to abandon hope.
4. to yield control of or concern in; relinquish: to abandon office.
5. to give up (something begun) before completion: to abandon a job; the game was abandoned.
6. to surrender (oneself) to emotion without restraint
7. (Insurance) to give (insured property that has suffered partial loss or damage) to the insurers in order that a claim for a total loss may be made
n
8. freedom from inhibitions, restraint, concern, or worry: she danced with abandon.');
如果有人能提供帮助就会很棒!
谢谢, 詹姆斯