dicService.
java
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class DicService {
public String synonym (String abc) throws SQLException
{
String synonym = "";
Connection con=null;
ResultSet rs=null;
Statement stmt=null;
try {
[Link]("connected");
[Link]("[Link]");
con = [Link]("jdbc:sqlserver://[Link];" +
"databaseName=trail;user=userone;password=userone");
stmt=[Link]();
[Link]("input value"+abc);
rs=[Link]("Select * from dictionary where word = '" +abc+ "'");
while([Link]()){
[Link]("id: " + [Link]("ID"));
[Link]("word: " + [Link]("WORD"));
[Link]("meaning: " + [Link]("MEANING"));
synonym = [Link]("MEANING");
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
[Link]();
}
finally{
[Link]();
[Link]();
[Link]();
}
[Link]("synonym"+synonym);
return synonym;
}
}
[Link]
<html>
<head>
<title>Convert Celsius to Fahrenheit Jsp</title>
</head>
<body>
<p align="center"><b>Dictionary service</b></p>
<form method="POST" action="Dictionary">
<p align="center"><b>Enter the word:</b>
<input type="text" name="sampleword" size="20">
<input type="submit" value="submit" name="B1"></p>
</form>
</body>
</html>
[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Meaning</title>
</head>
<body>
<p align="center"><b>Dictionary service</b></p>
<p align="center"><b>The meaning is:</b>
<%
String name = [Link]( "meaning" ).toString();%>
<%=name%>
</body>
</html>
[Link]
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class Dictionary extends HttpServlet
{
private static final long serialVersionUID = 1L;
public Dictionary()
{
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
}
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException
{
try
{
String synonym = [Link]("sampleword");
[Link] stub = new [Link]();
[Link] syn = new
[Link]();
[Link](synonym);
[Link]("text/html");
PrintWriter out = [Link]();
SynonymResponse res = [Link](syn);
[Link]("Meaning "+res.get_return());
[Link]("meaning", res.get_return());
[Link]("[Link]").forward(request,response);
}
catch(Exception e)
{
[Link]();
}
}
}