java web登陆问题
我想做个J2SE登陆到WEB的程序,但是登陆帐号密码核对完后,我就被WEB程序给T回了程序,我登陆的地方是后台,我想实现用J2SE对WEB后台操作,
请不要帖下面的代码:
URL url = new URL( "http://localhost/admin/chklogin.asp ");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod( "POST ");
conn.setDoOutput(true);
conn.setDoInput(true);
OutputStream raw = conn.getOutputStream();
OutputStream buf = new BufferedOutputStream(raw);
OutputStreamWriter out = new OutputStreamWriter(buf, "GBK ");
out.write( "admin=admin&password=admin ");
out.flush();
out.close();
conn.connect();
InputStream in=conn.getInputStream();
in=new BufferedInputStream(in);
Reader r=new InputStreamReader(in);