关于Applet通过Servlet得到数据库中数据的问题
写了一个Applet通过Servlet到数据库里去数据的程序,在servlet中只重载了一个get方法,现在通过在ie里面写入http://localhost:8080/CommunicationApp/servlet/serveletgetdata.ServletSQL?Select * from ServletDB中可以得到返回的结果,然而在Applet中写入一下一段代码却的不到结果,只是返回了这样的错误,请大家帮忙.
代码:
URL url = new URL ("http://10.8.23.44:8080/CommunicationApp/servletsql");
String StrSql = URLEncoder.encode( "StrSql" ) + "=" + URLEncoder.encode(Sql);
//String StrSql = "http://localhost:8080/CommunicationApp/servletsql?StrSql" + "=" + Sql;
URLConnection uc = url.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setUseCaches( false );
uc.setRequestProperty("Content-type","application/x-www-form-urlencoded");
DataOutputStream dos = new DataOutputStream(uc.getOutputStream());
dos.writeBytes(StrSql);
dos.flush();
dos.close();
错误:
2002-04-01 15:35:15 - Ctx( /CommunicationApp ): 405 R( /CommunicationApp + /servletsql + null) HTTP method POST is not supported by this URL