Socket « Post « JSP-Servlet Q&A

1. Data Posting Servlet

I have developed a servlet which posts data (using URL, URLConnection, getOutputStream()) to another web sites registration page and also other details. I also catch the response from that server (using BufferedInputStream, getInputStream()) as soon as my data has been posted. Unfortunately the other server response contains only its HTML content and not all the header fields required to further interact ...

3. Calling jsp from java class and posting data

public class testClass { public void postObjects(List Mylist1, List Mylist2) { for (int i=0; i< Mylist1.size(); i++) System.out.println("Items : +Mylist1.get(i).toString()); for (int i=0; i< Mylist2.size(); i++) System.out.println("Items : +Mylist2.get(i).toString()); // I am getting objects correctly and now I need code here which // will call JSP and post the data to jsp. } }

4. Servlet post to server using HttpUrlConnection

Hi there, In my servlet I will send data to a URL using method 'POST' with HttpUrlConnection class. But it happens to return me http code=411 from server which indicates content-length field. I try to send few data like "userid=username&pass=1234&msg=try+again" Here is my part of code: URL url; HttpURLConnection connection = null; try { //Create connection url = new URL(targetURL); connection ...