The Artima Developer Community
Sponsored Link

Java Answers Forum
Submit a form

1 reply on 1 page. Most recent reply: Oct 10, 2005 2:22 PM by Subodh Rawat

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Adi M

Posts: 1
Nickname: sharky
Registered: Oct, 2005

Submit a form Posted: Oct 9, 2005 4:53 AM
Reply to this message Reply
Advertisement
Hello
I have a problem when I try to submit a form.
I get the html page which has the form with this code:
URL u = new URL("http://www.mypage.my");
URLConnection uc = u.openConnection( );
uc.setDoOutput(true);
OutputStreamWriter out= new OutputStreamWriter(uc.getOutputStream( ), "ASCII");

I complete the form with this code

out.write("name=MyName\n");
............

And I get the response by this code:
InputStream in = uc.getInputStream();
int c;
while ((c= in.read())!=-1)
{
System.out.print((char) c);
}

The problem is that the respone is the old page, not the new page that should be by submitting the form.

How Can I resolve that?


Subodh Rawat

Posts: 9
Nickname: zeon
Registered: May, 2005

Re: Submit a form Posted: Oct 10, 2005 2:22 PM
Reply to this message Reply
HiAdi,

I am not sure to what page you are submiting the values too. But, try passing the values as query string as show below. Put the name of the jsp in place of <your jsp page>.

URL u = new URL("http://www.mypage.my/<your jsp page>?name=MyName");

-Zeon

Flat View: This topic has 1 reply on 1 page
Topic: A java class for simple select statement query builder Previous Topic   Next Topic Topic: Major Problem!!!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use