怎样配置web.xml? 一切都不需要改动。只要浏览器能够访问你的HTML页面就没有问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 当然是.class啦,xml不需要写的,系统自动已经写好了,如果你自己能写那就更好了! 比如我有一个text.java,text.class,text.html,其中,text.html中存放着applet的信息。但我在原目录中运行appletviewer text.html时,可以正常运行,但是当我把text.class打包,然后与text.html一起放在目录text中,然后又放在ROOT中时,在浏览器中却不能正常浏览,部分不能显示啊。 这是源代码。为什么在web页中就无法显示呢?import java.awt.event.*;import java.awt.Graphics;import java.awt.Font;import java.applet.Applet;/** * An applet that displays jittering text on the screen. * * @author Daniel Wyszynski 04/12/95 * @version 1.10, 02/05/97 * @modified 05/09/95 kwalrath Changed string; added thread suspension * @modified 02/06/98 madbot removed use of suspend and resume and cleaned up */public class NervousText extends Applet implements Runnable, MouseListener { String banner; // The text to be displayed char bannerChars[]; // The same text as an array of characters Thread runner = null; // The thread that is displaying the text boolean threadSuspended; // True when thread suspended (via mouse click) public void init() { banner = getParameter("text"); if (banner == null) { banner = "HotJava"; } int bannerLength = banner.length(); bannerChars = new char[bannerLength]; banner.getChars(0, banner.length(), bannerChars, 0); threadSuspended = false; resize(15*(bannerLength + 1), 50); setFont(new Font("TimesRoman", Font.BOLD, 36)); addMouseListener(this); } public void destroy() { removeMouseListener(this); } public void start() { runner = new Thread(this); runner.start(); } public synchronized void stop() { runner = null; if (threadSuspended) { threadSuspended = false; notify(); } } public void run() { Thread me = Thread.currentThread(); while (runner == me) { try { Thread.sleep(100); synchronized(this) { while (threadSuspended) { wait(); } } } catch (InterruptedException e){ } repaint(); } } public void paint(Graphics g) { for(int i=0, length = banner.length(); i<length; i++) { int x = (int) (10*Math.random() + 15*i); int y = (int) (10*Math.random() + 36); g.drawChars(bannerChars, i, 1, x, y); } } public synchronized void mousePressed(MouseEvent e) { e.consume(); threadSuspended = !threadSuspended; if (!threadSuspended) notify(); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public String getAppletInfo() { return "Title: NervousText\nAuthor: Daniel Wyszynski\nDisplays a text banner that jitters."; } public String[][] getParameterInfo() { String pinfo[][] = { {"text", "string", "Text to display"}, }; return pinfo; }} 换成另一个就可以哦,为什么会这样呢?嗯,什么时候要用到.xml啊,需要在这里面配置呢? 算了,不管他了。我想让applet像网页前的小窗口那样(那些不都是applet吧?),打开一个特定的网页的时候就会弹出来,我应该怎样写呢? 都回家过年了。呵呵应该不是代码问题。你在tomcat\conf\目录下的server.xml中加上<Context path="/text" docBase="text" debug="0" privileged="true"/>试试。tomcat的服务一般都放在webapps下,要改路径,需要设置什么。具体的我也不太明白了。我也刚开始用tomcat 应该不是这个问题,因为网页能找到,只是不能完好显示。难道是我的代码没有解压?我想让applet像网页前的小窗口那样(那些不都是applet吧?),打开一个特定的网页的时候就会弹出来,我应该怎样写呢? 奇怪,我启动TOMCAT的STARTUP,在IE地址栏中输入http://localhost:8080/为什么看不到TOMCAT 的默认界面呢? IE告诉我无法访问. 你设置TOMCAT_HOME了吗?设置了应该没什么问题。我的那个还是不行啊。能解决后一个问题吗?那个应该是很简单的啊。:) 我想不是web.xml的问题,应该是classpath的设置,去看看相关内容 回 ji_jian24(liufenghuixue)tomcat4.x 应设CATALINA_HOME 利用异常,确保输入非负 jfreechart开发图形统计,找不到org.jfree.ui.spacer 想升本了,不知应怎么办,各位兄弟指点一下吧! 如何打开一个HTML文件 简单问题 50分 JSP数据库连接 SVN 检出文件 关于java线程的一个问题 兄弟们,帮忙!怎么让web页中操作本地excel的数据插入能够实现... 快去呀!SCJP考试优惠!!(呵呵,给朋友做做广告) 如何使java_swing图形程序运行时不出现dos窗口? 新手的问题 这些表怎么用SQL写出来!!!!!!!!!!!!!(oracle8.16)
为什么在web页中就无法显示呢?
import java.awt.event.*;
import java.awt.Graphics;
import java.awt.Font;
import java.applet.Applet;/**
* An applet that displays jittering text on the screen.
*
* @author Daniel Wyszynski 04/12/95
* @version 1.10, 02/05/97
* @modified 05/09/95 kwalrath Changed string; added thread suspension
* @modified 02/06/98 madbot removed use of suspend and resume and cleaned up
*/public class NervousText extends Applet implements Runnable, MouseListener {
String banner; // The text to be displayed
char bannerChars[]; // The same text as an array of characters
Thread runner = null; // The thread that is displaying the text
boolean threadSuspended; // True when thread suspended (via mouse click) public void init() {
banner = getParameter("text");
if (banner == null) {
banner = "HotJava";
}
int bannerLength = banner.length();
bannerChars = new char[bannerLength];
banner.getChars(0, banner.length(), bannerChars, 0); threadSuspended = false; resize(15*(bannerLength + 1), 50);
setFont(new Font("TimesRoman", Font.BOLD, 36));
addMouseListener(this);
} public void destroy() {
removeMouseListener(this);
} public void start() {
runner = new Thread(this);
runner.start();
} public synchronized void stop() {
runner = null;
if (threadSuspended) {
threadSuspended = false;
notify();
}
} public void run() {
Thread me = Thread.currentThread();
while (runner == me) {
try {
Thread.sleep(100);
synchronized(this) {
while (threadSuspended) {
wait();
}
}
} catch (InterruptedException e){
}
repaint();
}
} public void paint(Graphics g) {
for(int i=0, length = banner.length(); i<length; i++) {
int x = (int) (10*Math.random() + 15*i);
int y = (int) (10*Math.random() + 36);
g.drawChars(bannerChars, i, 1, x, y);
}
} public synchronized void mousePressed(MouseEvent e) {
e.consume();
threadSuspended = !threadSuspended;
if (!threadSuspended)
notify();
} public void mouseReleased(MouseEvent e) {
} public void mouseEntered(MouseEvent e) {
} public void mouseExited(MouseEvent e) {
} public void mouseClicked(MouseEvent e) {
} public String getAppletInfo() {
return "Title: NervousText\nAuthor: Daniel Wyszynski\nDisplays a text banner that jitters.";
}
public String[][] getParameterInfo() {
String pinfo[][] = {
{"text", "string", "Text to display"},
};
return pinfo;
}
}
我想让applet像网页前的小窗口那样(那些不都是applet吧?),打开一个特定的网页的时候就会弹出来,我应该怎样写呢?
你在tomcat\conf\目录下的server.xml中加上
<Context path="/text" docBase="text"
debug="0" privileged="true"/>
试试。
tomcat的服务一般都放在webapps下,要改路径,需要设置什么。
具体的我也不太明白了。我也刚开始用tomcat
难道是我的代码没有解压?
我想让applet像网页前的小窗口那样(那些不都是applet吧?),打开一个特定的网页的时候就会弹出来,我应该怎样写呢?
奇怪,我启动TOMCAT的STARTUP,在IE地址栏中输入http://localhost:8080/
为什么看不到TOMCAT 的默认界面呢? IE告诉我无法访问.
我的那个还是不行啊。能解决后一个问题吗?那个应该是很简单的啊。
:)
tomcat4.x 应设CATALINA_HOME