在页面中向APPLET传递参数值:
<APPLET CODEBASE="xxxx" CODE="xxxx.class" > 
<PARAM NAME="aaa" VALUE="aaavalue"> 
<PARAM NAME="bbb" VALUE="bbbvalue"> 
</APPLET> 
applet中:
getParameter("aaa");
getParameter("bbb"); 

解决方案 »

  1.   

    在Applet程序中要书写获取外部参数的代码,如wulemale所言。
      

  2.   

    给段代码,参考一下:
      Image image;
      Image imgline;
      //设置标题的LABEL
      Label [][]Lab=new Label[8][2];
      //储存数据的LABEL
      Panel NorthPane;
      Panel LeftPane;
      String []title=new String[8];
      String []data=new String[8];
      String [] CheckLables=new String[9];
      Checkbox []outChecks=new Checkbox[9];
      String []strWaterLine;
      boolean drawFlag;
      String VV;
      String TV;
      String []His;
      double DamHeight;
      int DamPosX=360;
      int DamPosY=160;
      int testheight=320;
      int zrsw=285;
      int zrswposX,zrswposY;
      int ssw=274;
      int BaseX,BaseY;
      public void init() {
         title[0]="历史最高水位:";
     title[1]="历史最大蓄量:";
     title[2]="历史最大入流:";
     title[3]="历史最大出流:";
     title[4]="历集水面积:";
     title[5]="校核库容与当前库容差值:";
     title[6]="汛限库容与当前库容差值:";
     title[7]="";
     CheckLables[0]="校核水位";
     CheckLables[1]="设计水位";
     CheckLables[2]="正常水位";
     CheckLables[3]="汛限水位";
     CheckLables[4]="死水位";
     CheckLables[5]="总库容";
     CheckLables[6]="死库容";
     CheckLables[7]="调洪库容";
     CheckLables[8]="调节库容";
     TV=getParameter("WaterLine");
     strWaterLine=TV.split(",");
             His=getParameters(this,"HisData",",");  
     VV=getParameter("DrawFlag");
     DamHeight=Double.parseDouble(getParameter("DamHeight"));
     if (VV.equals("True"))
         drawFlag=true;
     else
         drawFlag=false;
         
     setLayout(new BorderLayout());
     this.setBackground(Color.lightGray);
     NorthPane=new Panel();
         NorthPane.setLayout(new GridLayout(4,4));
         for (int i=0;i<8 ;i++ )
         {
             
               Lab[i][0]=new Label(title[i]);
       NorthPane.add(Lab[i][0]);
       Lab[i][1]=new Label("");
       NorthPane.add(Lab[i][1]);
    }
     
     //获取历史数据
         for (int i=0;i<His.length;i++)
       {
           if (His[i]==null || His[i]=="")
             Lab[i][1].setText("无数据");
          else
             Lab[i][1].setText(His[i]);
            }
         LeftPane=new Panel();
         LeftPane.setLayout(new GridLayout(12,1,0,0));
         for (int i=0;i<9 ;i++ )
         {  
            outChecks[i]=new Checkbox(CheckLables[i]);
            outChecks[i].addItemListener(this);
            LeftPane.add(outChecks[i]);
     }
     add("North",NorthPane);
     add("West",LeftPane);
     image=getImage(getDocumentBase(),"dam.gif");
      

  3.   

    顺便看一下:
    http://expert.csdn.net/Expert/topic/2889/2889554.xml?temp=.7068598
      

  4.   

    如1楼所言,不过觉得传数据不是很方面,因为如果数据很多就麻烦了,
    但是不知道怎么用applet连数据库取数据,呵呵
    只是说说自己的想法,希望对楼主有帮助
      

  5.   

    对于多参数值多只能这样了:
    <APPLET CODEBASE="xxxx" CODE="xxxx.class" > 
    <PARAM NAME="aaa" VALUE="aaavalue,cccc,ddd,ggggg,ppppp,hhhh">  
    </APPLET> 
    定义一个函数:
     public String[]getParameters(Applet applet,String paramName,String Separators)
     {
          String paramstr=applet.getParameter(paramName);
          if (paramstr==null) 
              return new String[0];
          Vector vec=new Vector();
          StringTokenizer tok=new StringTokenizer(paramstr,Separators,true);
          while (tok.hasMoreTokens()) 
           {
               vec.addElement(tok.nextToken());
           }
               
           String[] returnvalues=new String[vec.size()];
           vec.copyInto((Object[])returnvalues);
           return   returnvalues;
     }
    ////////////////////////////
      getParameters(this,"aaa",",");
    所以感觉不好!
      

  6.   

    hehe~ MarGo(潇洒) 也是水电工作者~~