>>> "[Steven Shaw]" <[EMAIL PROTECTED]> 11-May-01 6:13:20 PM
>>>

>I have a long list of query results, tabulated.  The
>fist column is an <A REF>...</A> format, so that
>I can click on it and produce another query based
>on the value of the [text in the] link.

You mean you have something like this:

<table>
<tr>
<td>id</td>
<td>name</td>
<td>phone</td>
</tr>

<tr>
<td><a href="/query/?id=1">1</a></td>
<td>nic</td>
<td>8238 728 92783</td>
</tr>


>How do I pass the value of the link to a servlet
>that just serves up queries based on that value?

You just ensure that the link points to the servlet mapping.

In the example above the following would be used in your deployment
descriptor:


  <servlet>
    <servlet-name>query servlet</servlet-name>
    <servlet-class>com.nic.QueryServlet</servlet-class>
  </servlet>

  <servlet-mapping>
     <servlet-name>query servlet</servlet-name>
     <url-pattern>/query/*</url-pattern>
  </servlet-mapping>

And the servlet would look like this:

public class QueryServlet
extends HttpServlet
{
   public void doGet(...
   {
     String idStr=request.getParameter("id");
     int id=Integer.parseInt(idStr);
     //do query on id
     .
     .
     .
     PrintWriter out=response.getWriter();
     out.println("<table><tr><td>id</td><td>name</td>....
     out.println("<tr><td><a
href=\""+request.getServletPath()+"\">"+id+"</a></td>");
     .
     .
     .

}


Ok?


Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to