我有,QQ:12318872
MAIL:[email protected]
MAIL:[email protected]
解决方案 »
- java基础问题(很基础!!)
- 大家看看这个题目啊,速度来
- 请教用socket类做聊天程序时的问题
- Calendar.getInstance().getTimeInMillis()和System.currentTimeMillis()是否有区别?
- 关于java变量生存周期问题,望解答小弟难题
- 有没有人帮我看一下这道题怎么些
- 一个简单存取用户购物bean问题!请高手指教
- [求助]Hello World执行中遇到的问题
- 请教高手!怎么读取网页里面的iframe 和javascript输出代码?
- 请问:“怎样把一个APPLET程序代码加上主函数(MAIN)举例说明呀!
- 请问oracle8.05的jdbc驱动程序在哪里可以找到?
- 求助一个方法,简单阿!!!!!有关删除文件夹的
mail:[email protected]
import java.awt.event.*;
import java.applet.*;import javax.swing.*;
import java.util.*;
import java.io.*;
import java.net.*;
import javax.swing.text.*;
import java.net.URL;public class Applet1 extends Applet {
boolean isStandalone = false; URL url;
String uri = "init";
String servletAddress = "init";
String urlS = "init";
String uriS ="init";
String sqlAptToSvl="";
/**Get a parameter value*/
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
} /**Initialize the applet*/
public void init() {
try {
jbInit();
readCfgByParameter() ;
connectServlet(servletAddress);
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
}
/**Get Applet information*/
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo() {
return null;
} public void connectServlet(String s){
if (s.length() == 0){
return;
}
try{
java.net.URL url = new java.net.URL (s);
java.net.URLConnection con = url.openConnection() ; //intialize the connection
con.setUseCaches(false) ;
con.setDoOutput(true) ;
con.setDoInput(true) ; ObjectInputStream in = new ObjectInputStream(con.getInputStream() );
//read the data
sqlAptToSvl = in.readUTF();
URL myURL=new URL(getCodeBase(),sqlAptToSvl);
in.close();
Object o=myURL.getContent();System.out.println(sqlAptToSvl);
}
catch (Exception e){ e.printStackTrace();
return;
} } public String readCfgByParameter() { byte buffer[] = new byte[2056]; try { InputStream fileIn= new FileInputStream("conSer.cfg");
int bytes = fileIn.read(buffer, 0, 2056); String strFile = new String(buffer, 0, bytes, "Default");
servletAddress = strFile;
System.out.println(strFile) ;
return servletAddress; }catch(Exception e){
return "Read config file failed!";
} } }