If I have a search submit button, when I click submit button, it will
submit the form to search.asp for form processing.
This will be the URL:
http://www.mycompany.com/search.asp?q=programming
But when I do search in google, search doesn't have any file extension.
How do they do that? I saw some site are like that too.
http://www.google.com/search?hl=en&q=programming&btnG=Google+Search
Since you cross-posted this to a Java newsgroup as well, I'll give you
the answer in Java servlets. Followups set.
When you map a servlet to a URI, you do so with a <servlet-mapping>
element in WEB-INF/web.xml. That URI pattern can have a number of
different forms (including various uses of wildcards), but you can very
easily write:
<servlet-mapping>
<servlet-name>my_servlet</servlet-name>
<url-pattern>/search</url-pattern>
</servlet-mapping>
If you're using a JSP, then it's a little more complicated. In general,
though, JSPs should never be the direct targets of requests from
browsers. It's far more flexible to handle HTTP requests with a
servlet, and then use RequestDispatcher to forward to the appropriate
JSP file depending on how you wish to respond. That even leaves you the
flexibility to avoid a JSP entirely; for example, if you need to
generate an image, or build an extremely dynamic page programmatically
with Apache ECS, or something of that sort.
If you insist on using JSPs to handle browser requests directly, then
you would either need to add a servlet mapping for the JSP servlet to
web.xml (generally, the JSP servlet is called "jsp", but I'm not sure
off-hand whether that is specified or container-specific), or you could
use any of the same techniques mentioned by the PHP folks already, with
an Apache front-end.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation