On 15/10/2008, boy456 <[EMAIL PROTECTED]> wrote:
>
> Thank you very much for your help. I understand that there are some other
> parameters available concerning the two different forms on the page. I have
> tried to offer different combinations of paramters but I don't understand
> the logic how to prevent the first form to capture the submit parameter
> (they both have exactly same submit parameter).
>
> Is it really a correct approach to define all possible parameters for both
> forms? How should I define the parameters of the first form so that they
> would not be taken into consideration? I have tried null and "" with no
> success. Is there any command that can force only the parameters of the
> second form to be activated? I am very thankful if you can clarify for me
> the logic.
>
> I am going to use "Wikipedia what links here" page that provides to search
> boxes. I would like to send ONLY the second form of these to that appear on
> the page:
>
> <form action="/wiki/Special:Search" id="searchform"><div>
Compare the action ...
> <input id="searchInput" name="search" type="text" title="Search Wikipedia
> [f]" accesskey="f" value="" />
> <input type='submit' name="go" class="searchButton" id="searchGoButton"
> value="Go" title="Go to a page with this exact name if one exists" />
> <input type='submit' name="fulltext" class="searchButton"
> id="mw-searchButton" value="Search" title="Search Wikipedia for this text"
> />
> </div></form>
>
> <form action="/w/index.php"><input name="title" type="hidden"
... with this action.
Notice any difference?
> value="Special:WhatLinksHere" /><input name="limit" type="hidden"
> value="500" /><input name="hideredirs" type="hidden" value="1" /><input
> name="hidetrans" type="hidden" value="1" /><fieldset>
> <legend>What links here</legend>
> <label for="mw-whatlinkshere-target">Page:</label> <input name="target"
> size="40" value="Eno" id="mw-whatlinkshere-target" /> <label
> for="namespace">Namespace:</label> <select id="namespace"
> name="namespace" class="namespaceselector">
> <option value="" selected="selected">all</option>
> <option value="0">(Article)</option>
> <option value="1">Talk</option>
> <option value="2">User</option>
> </select><input type="submit" value="Go" /></fieldset></form>
>
> Please if you just can provide me a small example of the parameter
> definitions that I should use.
> Thank you very much!
>
>
>
>
> sebb-2-2 wrote:
> >
> > On 15/10/2008, boy456 <[EMAIL PROTECTED]> wrote:
> >
>
> > There must be a difference between the forms, or the server will not
> > be able to distinguish which one has been used.
> >
> > Either there is a different parameter value, or, more likely, the
> > Submit URL is different.
> >
> >> Thanks for helping.
> >>
> >>
> >> import java.io.FileOutputStream;
> >> import java.io.IOException;
> >> import org.apache.commons.httpclient.*;
> >> import org.apache.commons.httpclient.methods.GetMethod;
> >>
> >> public class SubmitHttpForm {
> >>
> >> private static String url =
> >> "http://www.website.com";
> >>
> >> public static void main(String[] args) {
> >>
> >> //Instantiate an HttpClient
> >> HttpClient client = new HttpClient(new
> >> MultiThreadedHttpConnectionManager());
> >>
> >> //Instantiate a GET HTTP method
> >> HttpMethod method = new GetMethod(url);
> >>
> >> //Define name-value pairs to set into the QueryString
> >> NameValuePair nvp1= new NameValuePair("search","");
> >> NameValuePair nvp2= new NameValuePair("submit","");
> >> NameValuePair nvp3= new NameValuePair("search","route");
> >> NameValuePair nvp3= new NameValuePair("submit","go");
> >>
> >> method.setQueryString(new NameValuePair[]{nvp1,nvp2, nvp3, nvp4});
> >>
> >> try{
> >> int statusCode = client.executeMethod(method);
> >>
> >> System.out.println("QueryString>>>
> >> "+method.getQueryString());
> >> System.out.println("Status Text>>>"
> >> +HttpStatus.getStatusText(statusCode));
> >>
> >> //Get data as a String
> >> System.out.println(method.getResponseBodyAsString());
> >>
> >> //OR as a byte array
> >> byte [] res = method.getResponseBody();
> >>
> >> //write to file
> >> FileOutputStream fos= new
> >> FileOutputStream("./output/donepage.html");
> >> fos.write(res);
> >>
> >> //release connection
> >> method.releaseConnection();
> >> }
> >> catch(IOException e) {
> >> e.printStackTrace();
> >> }
> >> }
> >> }
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/How-to-handle-two-forms-on-one-page-with-apache-httpclient-tp19991354p19991354.html
> >> Sent from the HttpClient-User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> --
> View this message in context:
> http://www.nabble.com/How-to-handle-two-forms-on-one-page-with-apache-httpclient-tp19991354p19995478.html
>
> Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]