Codigo Android
Código Java:
Ver original
// String user = edtxt1.getText().toString(); // String pass = edtxt2.getText().toString(); try { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); List<NameValuePair> pairs = new ArrayList<NameValuePair>(); pairs.add(new BasicNameValuePair("UserName", "aldo")); pairs.add(new BasicNameValuePair("PassworD", "Zuñiga")); post.setEntity(new UrlEncodedFormEntity(pairs)); HttpResponse response = client.execute(post); } { e.printStackTrace(); } }
y Codigo JSP
Código HTML:
Ver original
<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="java.io.*" %> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <% String uName = request.getParameter("UserName"); String password = request.getParameter("PassworD"); %> <body> <%=uName != null ? "\n" + uName : "\nNo Username available"%> <%=password != null ? "\n" + password : "\nNo Password Available"%> <% if (uName != null && password != null) { try { FileWriter fw = new FileWriter("D:\\data.txt"); BufferedWriter bw = new BufferedWriter(fw); bw.write(uName); bw.write(password); bw.close(); } catch (Exception e) { e.printStackTrace(); } } %> </body> </html>