• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

building a searching tool for jsp pages

 
Farooq Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
I am developing a jsp/servlet based web directory. I would like some help in creating a tool or maybe a bean which can search through the database & return results.
like match names or categories or area etc

help is appreciated

farooq
[ October 16, 2007: Message edited by: Bear Bibeault ]
 
Bommaraju Chaitanya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First Two tables in the database.

1)In one table maintain two fields one is kno as primary key, and second field as List of Keywords in your site.

2)In the second table maintain three fields one for urlid, urls and kno (foreign key)

insert your urlid's as about.html,contactus.html

In the html page use the input tag.
<form action="search.jsp" method="post">
<input type="text" name="search">
<input type="submit" value="go">

then get the request in jsp page as follows
<% String search=request.getParameter("search");
Then in the jsp page write the query as
rs=st.executeQuery("select * from urls where urls.kno=(select kno from keywords where keyword='"+search+"')");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic