当前位置: 首页 > 图文教程 > 网络编程 > JSP > JAVA/JSP学习系列之十四

JSP
我认为JSP有问题(上)
我认为JSP有问题(下)
jsp“抓”网页代码的程序
关于在bean里面打印html的利弊看法
bean里面如何打印到html页面
jdbc3中的RowSet 接口规范
Apusic Application Server1.0中jsp源代码泄漏漏洞
Unify的eWave ServletExec拒绝服务漏洞
通过提交超长的GET请求导致IBM HTTP Server远程溢出
在HTTP请求中添加特殊字符导致暴露JSP源代码文件
Resin 1.2 重要源代码暴露漏洞
多中WEB服务器的通用JSp源代码暴露漏洞
Tomcat 暴露JSP文件内容
IBM WebSphere Application Server 暴露JSP文件内容
JRun 2.3.x 范例文件暴露站点安全信息
BEA WebLogic 暴露源代码漏洞
IBM WebSphere Application Server 3.0.2 存在暴露源代码漏洞
Tomcat 3.1 存在暴露网站路径问题
Sun Java Web Server 能让攻击者远程执行任意命令
Netscape 修复 JAVA 安全漏洞

JAVA/JSP学习系列之十四


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-04   浏览: 55 ::
收藏到网摘: n/a

下面的例子将说明利用javascript去改变applet状态和在javascript中调用applet中的方法。

一、applet源代码(tmin_JS2.java)

// Import
import java.awt.Graphics ;
import java.awt.Event ;

// LiveConnect... for JavaScript
// Not used... (it's more simple)


public class tmin_JS2 extends java.applet.Applet {
// Variables
String str ; // Sample string...
int i ; // nb change...


// Initialisation de l'applet
public void init() { // Methode init()
str = new String("test");
i = 0 ;
}

// Dessiner l'applet
public void paint(Graphics g) { // Methode paint()
g.drawString(str, 5, 10) ;
}

// setString : change string value
public void setString(String s) {
str = new String( s );
i++ ;

// force repaint to see change
repaint() ;
return ;
}

// getString : get string value
public String getString() {
return str ;
}

// getVal : get number of change
public int getVal() {
return i ;
}

}

二、注意的地方

(1)在applet中,要命名:

<APPLET codeBase="./" code=tmin_JS2 width=80 height=25 NAME=test1 >