Can the Web Search be done with JSP?

For those use the Firefox browser, you may know the Web Search add-on. It has a drop-down list and a input field. The drop-down list contains various customized search sites such as Google, Yahoo, Webster etc.. A user can specify what and where to search. Can this be done with JSP?
[289 byte] By [vwuvancouvera] at [2007-10-3 9:36:56]
# 1

> For those use the Firefox browser, you may know the

> Web Search add-on. It has a drop-down list and a

> input field. The drop-down list contains various

> customized search sites such as Google, Yahoo,

> Webster etc.. A user can specify what and where to

> search. Can this be done with JSP?

Sure. Google has an API which will help you interface with their search engine.Other engines probably do as well. Otherwise you you could just learn the URL parameter scheme each og the search engines use to make a search and use that to get results.

stevejlukea at 2007-7-15 4:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

It sounds quite easy for you, Steve. Let's see how you can do it. Here are the URLs for various searching sites:

http://www.google.com/search?q=

http://search.yahoo.com/search?p=

http://www.answers.com/main/ntquery?s=

http://www.webster.com/dictionary/

http://en.wikipedia.org/wiki/Special:Search?search=

And the above searching sites are configurable by a user. I guess you will need some html tags: form, list, input.

vwuvancouvera at 2007-7-15 4:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> It sounds quite easy for you, Steve.

Easy enough.

> Let's see how

> you can do it.

Let's not. Why not see how you do it, and when you run into trouble, ask specific questions. I am not about to do your work for you. You just are making yourself sound like a lazy SOB. Why not prove yourself otherwise?

> Here are the URLs for various

> searching sites:

> > http://www.google.com/search?q=

> http://search.yahoo.com/search?p=

> http://www.answers.com/main/ntquery?s=

> http://www.webster.com/dictionary/

> http://en.wikipedia.org/wiki/Special:Search?search=

>

> And the above searching sites are configurable by a

> user. I guess you will need some html tags: form,

> list, input.

Sounds about right.

stevejlukea at 2007-7-15 4:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I could answer ANY questions posted here in the same approach as what Steve has demonstrated here.

The first thing I would say, "It is easy." The second thing I would say, "you go to figure out how to solve the problem yourself if you are not lazy".

Do I really know how to solve the problem? Unlikely. Do I feel good about myself? Definitely.

Back to the question, for those who know the form tag, the action attribute needs to be defined to create a form on JSP/html. In this case, the action is one of those URLs. That is not fixed value, but a dynamic one. Clearly, html can't handle this issue. I try to figure out whether it is a solution in JSP.

vwuvancouvera at 2007-7-15 4:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

> Back to the question, for those who know the form

> tag, the action attribute needs to be defined to

> create a form on JSP/html. In this case, the action

> is one of those URLs. That is not fixed value, but a

> dynamic one. Clearly, html can't handle this issue.

> I try to figure out whether it is a solution in JSP.

See that''s a more specific question. Yes you can do it in JSP, but it is probably a little easier to do in normal javascript.

For example, have a select box to choose which search engine you want to use. The select box has an onchange event that determines what value was selected and set the action element in the form tag appropriately.

Alternatively, you could use a streight HTML form that submits to the server and the response is a JSP which reads the parameters and does a META-REFRESH to the correct page with the search term filled in.

See, there's two methods thought up since I pressed the reply button. Your turn to see how to implement them.

stevejlukea at 2007-7-15 4:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...