/** * The way the POST request is used * * @param username * @param password * @return NULL indicates a problem with the evaluated path, text returns the requested data */public static String Pos Trequest (string Username, string password) {try {string path = "http://172.22.64.156:8080/0001AndroidWebService/ Loginservlet "; URL url = new URL (path); HttpURLConnection conn = (httpurlconnection) url.openconnection (); Conn.setreadtimeout (+) Conn.setrequestmethod (" POST "),//username=donghongyu&&password=123//prepare the data to be transferred string" username= "+ urlencoder.encode (username) + "&password=" + urlencoder.encode (password);//sets the type of the requested content Conn.setrequestproperty ("Content-type", "application/ X-www-form-urlencoded "); Conn.setrequestproperty (" Content-length ", data.length () +" ");// Open the Write permissions to the server Conn.setdefaultusecaches (TRUE);//get the output stream of the HTTP connection outputstream OS = Conn.getoutputstream ();// Writes Data Os.write (Data.getbytes ()) to the server, int code = Conn.getresponsecode (), if (code = = 200) {//Request succeeds InputStream is = CONN.GETINP Utstream (); String Text = Streamutil.readstream (is); return text;} else {//request failed return null;}} catch (Exception e) {e.printstacktrace ();} return null;}