自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (6)
  • 收藏
  • 关注

空空如也

Smarty3的chm手册

Smarty3的chm手册 Smarty3的chm手册 Smarty3的chm手册 Smarty3的chm手册 Smarty3的chm手册

2011-08-16

ubuntu安装步骤

ubuntu安装: 首先保证互联网连通,一般选用bridge或者nat方式 网络中断可能是因为windows的以下服务没有启动 vmware Dhcp service vmware Nat service

2011-08-16

SVNSVNsvn参考书

多个关键字请用空格分隔,最多填写5个。点击右侧Tag快速添加 多个关键字请用空格分隔,最多填写5个。点击右侧Tag快速添加

2010-01-29

php+fckeditor

FCKeditor是个什么东西呢?大部分朋友应该很熟悉,对于很清楚地朋友这篇文章往下就不要看了哈,以免浪费宝贵的时间,毕竟我们这行时间宝贵纳…啰嗦了那么多还没进主体,有些浪费篇面之嫌。好了开始介绍FCKeditor吧,在线编辑器大家可能都清楚,现在介绍的这款在线编辑器绝对是在线编辑器中的大腕…它拥有着强大的功能,支持多种浏览器,无平台限制,可以和多种WEB语言融合,支持多种脚本编程语言,开源,最重要的就是使用简单。 关于FCKeditor功能的详细阐述及其相应得版本请到http://www.FCKeditor.net官方网站下载。现在将从FCKeditor的调用方式、修改配置、详细修改介绍FCKeditor在php中的使用。

2009-04-01

Java反编译软件JAD1

Java反编译软件JAD1 ad -sjava example1.class生成example1.java文件,十分准确。 This is README file for Jad - the fast Java Decompiler. Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html Copyright 1997-99 Pavel Kouznetsov ([email protected]). 0. Please read the disclaimer on the Jad home page. 1. Installation. Unzip jad.zip file into any appropriate directory on your hard drive. This will create two files: - an executable file named 'jad.exe' (Windows 95/NT) or 'jad' (Linux) - this README file No other setup is required. 2. How to use Jad To decompile a single JAVA class file 'example1.class' type the following: jad example1.class This command will create file 'example1.jad' in the current directory. If such file already exists Jad asks if you want to overwrite it. Option -o allows overwriting without confirmations. You can omit .class extension and/or use wildcards in the names of input files. Option -s <ext> allows to change output file extension: jad -sjava example1.class This command will create file 'example1.java'. Be careful when using options -o and -sjava together, because Jad can accidentally overwrite your own source files. Jad uses JAVA class name as an output file name. For example, if class file 'example1.class' contains JAVA class 'test1' then Jad will create file 'test1.jad' rather then 'example1.jad'. If you want to specify your own output file name use output redirection: jad -p example1.class > myexm1.java Option -d allows you to specify another directory for output files, which are created, by default, in the current directory. For example: jad -o -dtest -sjava *.class (or jad -o -d test -s java *.class, which has the same effect) This command will decompile all .class files in the current directory and place all output files with extension .java into directory 'test'. If you want to decompile the whole tree of JAVA classes, then use the following command: jad -o -r -sjava -dsrc tree/**/*.class This command will decompile all .class files located in all subdirectories of 'tree' and create output files in subdirectories of 'src' according to package names of classes. For example, if file 'tree/a/b/c.class' contains class 'c' from package 'a.b' then output file will have a name 'src/a/b/c.java'. Note the use of 'two asterisks' wildcard ('**') in the previous command. It is handled by Jad rather then command shell, so on UNIX the last argument should be single-quoted: jad -o -r -sjava -dsrc 'tree/**/*.class' In case you want to check the accuracy of the decompilation or just curious, there is an option -a which tells Jad to annotate the output with JAVA Virtual Machine bytecodes. Jad supports inner and anonymous classes. When Jad expands wildcards in the input file names, it automatically skips matching inner classes. On UNIX Jad skips inner classes if there is more than one class specified in the command line. Jad looks for inner classes in the directory of their top-level container class. 3. List of the command-line options. Jad accepts the following options: -a - annotate the output with JVM bytecodes -af - same as -a, but outputs fully qualified names when annotating; -clear - clears all prefixes, including the default ones (can be abbreviated as -cl) -b - output redundant braces (e.g., if(a) { b(); }, default: no) -d <dir> - directory for output files (will be created when necessary) -dead - try to decompile dead parts of code (if any) (default: no) -disass - disassemble method bytecodes (no JAVA source generated) -f - output fully qualified names for classes/fields/methods -ff - output class fields before methods (default: after methods) -i - output default initializers for all non-final fields -l<num> - split strings into pieces of maximum <num> chars (default: no) -nl - split strings on newline character (default: no) -nodos - do not check for class files in DOS mode (default: check) -nocast - don't generate auxiliary casts -nocode - don't generate the source code for methods -noconv - don't convert Java identifiers (default: do) -noctor - suppress the empty constructors -noinner - turn off the support of inner classes (default: turn on) -nolvt - ignore Local Variable Table information -nonlb - don't output a newline before opening brace (default: do) -o - overwrite output files without confirmation (default: no) -p - send decompiled code to STDOUT (e.g., for piping) -pi<num> - pack imports into one line after <num> imports (default: 3) -pv<num> - pack fields with identical types into one line (default: no) -pa <pfx>- prefix for all packages in generated source files -pc <pfx>- prefix for classes with numerical names (default: _cls) -pf <pfx>- prefix for fields with numerical names (default: _fld) -pe <pfx>- prefix for unused exception names (default: _ex) -pl <pfx>- prefix for locals with numerical names (default: _lcl) -pm <pfx>- prefix for methods with numerical names (default: _mth) -pp <pfx>- prefix for method parms with numerical names (default: _prm) -r - restore package directory structrure -s <ext> - output file extension (by default '.jad') -stat - display the total number of processed classes/methods/fields -t - use tabs instead of spaces for indentation -t<num> - use <num> spaces for indentation (default: 4) -v - display method names being decompiled -8 - convert UNICODE strings into 8-bit strings using current ANSI code page (Win32 only) -& - redirect stderr to stdout (Win32 only) All single-word options have three formats: -o - 'reverses' value of an option -o+ - set value to 'true' or 'on' -o- - set value to 'false' or 'off'

2008-12-10

tomcat 4.1

很好用的东西,到官网都下不到的!!! tomcat的配置 一、开发环境配置 第一步:下载j2sdk和tomcat:到sun官方站(http://java.sun.com/j2se/1.5.0/download.jsp)下载 j2sdk,注意下载版本为Windows Offline Installation的SDK,同时最好下载J2SE 1.5.0 Documentation,然后到tomcat官方站点(http: //jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi)下载tomcat(下载最新 5.5.9版本的tomcat); 第二步:安装和配置你的j2sdk和tomcat:执行j2sdk和tomcat的安装程序,然后按默认设置进行安装即可。 1.安装j2sdk以后,需要配置一下环境变量,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的j2sdk安装在c:\j2sdk1.5.0): JAVA_HOME=c:\j2sdk1.5.0 classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;(.;一定不能少,因为它代表当前路径) path=%JAVA_HOME%\bin 接着可以写一个简单的java程序来测试J2SDK是否已安装成功: public class Test{ public static void main(String args[]){ System.out.println("This is a test program."); } } 将上面的这段程序保存为文件名为Test.java的文件。 然后打开命令提示符窗口,cd到你的Test.java所在目录,然后键入下面的命令 javac Test.java java Test 此时如果看到打印出来This is a test program.的话说明安装成功了,如果没有打印出这句话,你需要仔细检查一下你的配置情况。 2.安装Tomcat后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的tomcat安装在c:\tomcat): CATALINA_HOME=c:\tomcat CATALINA_BASE=c:\tomcat 然后修改环境变量中的classpath,把tomat安装目录下的common\lib下的(可以根据实际追加)servlet.jar追加到classpath中去,修改后的classpath如下: classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar; 接着可以启动tomcat,在Tomcat的安装目录下找到Bin目录,在Tomcat4.0的版本中,双击Startup即可,5.5的版本下双击Tomcat5.exe即启动了Tomcat服务了,然后在IE中访问http://localhost:8080,如果看到tomcat的欢迎页面的话说明安装成功了。 第三步:建立自己的jsp app目录 1.到Tomcat的安装目录的webapps目录,可以看到ROOT,examples, tomcat-docs之类Tomcat自带的的目录; 2.在webapps目录下新建一个目录,起名叫myapp; 3.myapp下新建一个目录WEB-INF,注意,目录名称是区分大小写的; 4.WEB-INF下新建一个文件web.xml,内容如下: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>My Web Application</display-name> <description> A application for test. </description> </web-app> 5.在myapp下新建一个测试的jsp页面,文件名为index.jsp,文件内容如下: <html><body><center> Now time is: <%=new java.util.Date()%> </center></body></html> 6.重启Tomcat 7.打开浏览器,输入http://localhost:8080/myapp/index.jsp 看到当前时间的话说明就成功了。 第四步:建立自己的Servlet: 1.用你最熟悉的编辑器(建议使用有语法检查的java ide)新建一个servlet程序,文件名为Test.java,文件内容如下: package test; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Test extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); out.println("<html><body><h1>This is a servlet test.</h1></body></html>"); out.flush(); } } 2 .编译 将Test.java放在c:\test下,使用如下命令编译: C:\Test>javac Test.java 然后在c:\Test下会产生一个编译后的servlet文件:Test.class 3 .将结构test\Test.class剪切到%CATALINA_HOME%\webapps\myapp\WEB-INF\classes下,也就是剪切那个test目录到classes目录下,如果classes目录不存在,就新建一个。现在webapps\myapp\WEB-INF\ classes下有test\Test.class的文件目录结构 4 .修改webapps\myapp\WEB-INF\web.xml,添加servlet和servlet-mapping 编辑后的web.xml如下所示,红色为添加的内容: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>My Web Application</display-name> <description> A application for test. </description> <servlet> <servlet-name>Test</servlet-name> <display-name>Test</display-name> <description>A test Servlet</description> <servlet-class>test.Test</servlet-class> </servlet> <servlet-mapping> <servlet-name>Test</servlet-name> <url-pattern>/Test</url-pattern> </servlet-mapping> </web-app> 这段话中的servlet这一段声明了你要调用的Servlet,而servlet-mapping则是将声明的servlet"映射"到地址/Test上 5 .好了,重启动Tomcat,启动浏览器,输入http://localhost:8080/myapp/Test 如果看到输出This is a servlet test.就说明编写的servlet成功了。 注意:修改了web.xml以及新加了class,都要重启Tomcat 第四步:建立自己的Bean: 1.用你最熟悉的编辑器(建议使用有语法检查的java ide)新建一个java程序,文件名为TestBean.java,文件内容如下: package test; public class TestBean{ private String name = null; public TestBean(String strName_p){ this.name=strName_p; } public void setName(String strName_p){ this.name=strName_p; } public String getName(){ return this.name; } } 2 .编译 将TestBean.java放在c:\test下,使用如下命令编译: C:\Test>javac TestBean.java 然后在c:\Test下会产生一个编译后的bean文件:TestBean.class 3 .将TestBean.class文件剪切到 %CATALINA_HOME%\webapps\myapp\WEB-INF\classes\test下, 4 .新建一个TestBean.jsp文件,文件内容为: <%@ page import="test.TestBean" %> <html><body><center> <% TestBean testBean=new TestBean("This is a test java bean."); %> Java bean name is: <%=testBean.getName()%> </center></body></html> 5 .好了,重启Tomcat,启动浏览器,输入http://localhost:8080/myapp/TestBean.jsp 如果看到输出Java bean name is: This is a test java bean.就说明编写的Bean成功了。 这样就完成了整个Tomcat下的jsp、servlet和javabean的配置。接下来需要做的事情就是多看书、多读别人的好代码,自己多动手写代码以增强自己在这方面开发的能力了。 jvm应填写到 c:\j2sdk\bin 给你一个简单的配置:::: JSP环境配置心得 首先要说的是,使用jdk+tomcat完全可以配置我们的jsp服务器,不再需要其实任何东东,有很多文章介绍了Apache,其实根本用不着,一般的学习调试tomcat完全可以胜任了。 安装jdk后,tomcat在安装之前会自动找到jdk的安装路径,一路点击"下一步",经过一段时间的文件复制,最后"close",完成comcat的安装。 您最好去下载一个版本较高的tomcat,比如4.1以上的,因为它不需要设置太多的系统变量,右击"我的电脑",选择"属性"->"高级"- >"环境变量"->"系统变量",新建一个TOMCAT_HOME,值设置成你的tomcat所在的路径,比如:D:\Program Files\Apache Group\Tomcat 5.5,配置完成。 从开始菜单中找到tomcat选项,一般打开顺序是:开始->程序->Apache Tomcat 5.5,选择"Start Tomcat",让jsp服务器开始运行,此时会打开一个类似Dos的窗口,会显示一些相关的信息。 如果您使用代理上网,一定要先撤掉代理,不然您的jsp程序永远也得不到执行。如果不是代理的,这一步就跳过了。 打开浏览器,在地址栏中输入:http://localhost:8080,如果看到有老虎(我也不知道是老虎还是猫)的画面,恭喜您,您成功了一半。 先来享受一下成功的喜悦吧,请输入下面的代码: <html> <head> <title>First Page</title> </head> <body> <H3>Today is: h <%= new java.util.Date() %> </H3> </body> </html> 将该程序保存为:First.jsp,放到Tomcat的ROOT目录下,然后在浏览器的地址栏中输入:http://localhost: 8080/First.jsp,(First.jsp跟我们保存的文件名的大小写要一致)回车,如果不出意外,应该可以看到形如Today is: h Fri Apr 11 08:32:38 CST 2003 的结果。 注意:ROOT是tomcat的默认虚拟目录,如果要改成自己的虚拟目录怎么办呢?请继续往下看吧。 要改成自己的虚拟目录,就要请出server.xml来了,该文件是一个配置文件,在Tomcat\conf目录下,使用任何文本编辑软件都能打开它,我们先找到下面一句: <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true" /> 这里的port="8080"就是端口,我们完全可以用别的端口来代替,但不能是被系统占用的端口(0--1023),这里简单提一下。 下面我们再往下找,会发现以下的语句: </Context> </Host> 我们就应该找到这两个语句,如果不懂E文,您就认定这两个语句好了。然后我们将该语句更改如下: </Context> <Context path="/myjsp" debug="0" docBase="e:/myjsp" reloadable="true"> </Context> </Host> 这里的path="/myjsp"就是我们就配置的虚拟目录了,以后在地址栏中输入http://localhost:8080/myjsp即可。而docBase="e:/myjsp" 则是机器本地路径,他们通过这个语句形成一个映射关系,其它照抄。 将上面的First.jsp文件放到e:/myjsp目录下,输入http://localhost:8080/myjsp/First.jsp,是不是有一种喜上眉梢的感觉? 在论坛里我见得最多的就是很多人不知道javaBean文件放到哪里,老实说开始我也不知道,更令人不解的是,十个人有九种不同的说法,这更让我们茫然。其实这问题也不是我们想像的那么复杂,我们以一个例子说明: 先建立一个java程序,代码如下: package hall; public class SimpleBean { private String message = "No message specified"; public String getMessage() { return(message); } public void setMessage(String message) { this.message = message; } } 保存为SimpleBean.java,编译后会生成一个包,其实就相当于一个目录,也就是SimpleBean.class会存放在hall目录中,暂且保存起来,将来备用。 再输入以下代码: <HTML> <HEAD> <TITLE>Reusing JavaBeans in JSP</TITLE> </HEAD> <BODY> <CENTER> <TABLE BORDER=5> <TR><TH CLASS="TITLE"> Reusing JavaBeans in JSP</TABLE> </CENTER> <P> <jsp:useBean id="test" class="hall.SimpleBean" /> <jsp:setProperty name="test" property="message" value="Hello WWW" /> <H1>Message: <I> <jsp:getProperty name="test" property="message" /> </I></H1> </BODY> 保存在我们刚才建立的虚拟目录e:/myjsp下面,并命名为:BeanTest.jsp。 现在我们应该将hall(包)目录放在哪儿呢?别急,我们先在e:/myjsp下建立一个文件夹WEB-INF,然后再在WEB-INF下建立一个 classes文件夹,最后将hall目录放到classes下,当然,hall下的字节码文件SimpleBean.class也一并要移过来,而 SimpleBean.java就和BeanTest.jsp放到同一目录吧(可以不需要放的,自己试试)。 重新启动机器(如果您试了好多次都不行,这一步一定要做),在浏览器中输入:http://localhost:8080/myjsp/BeanTest.jsp,您看到了什么?呵,别告诉我您什么都没看到,那肯定是您设置的问题了。 Java学习 - 技术文章中心 初学者问的诸如:《怎样配置环境变量》《怎样运行Servlet》啊?这样的问题太多了,现在我写一个初学者入门必读,以便对初学者有指导作用! 首先是下载工具: 我建议初学者用Editplus+JDK,我觉得如果用例如JB,Eclipse,JCreator,虽然刚开始的时候比较方便,但是确使初学者门不知道怎样配置环境变量, 从而难以达到知其然,知其所以然的地步 可以通过如下地址下载: Editplus (最新版本是v2.11):http://count.skycn.com/softdown.php?id=3641&url=http: //sc-http.skycn.net/down/epp211a_cn.exe(要照注册码就自己找吧,网上很多的) JDK(最新版本是Java2sdk1_5_0):http: //192.18.97.54/ECom/EComTicketServlet/BEGIN30AA3B63E5C2F61C8C26F84B78970A98/ -2147483648/926882595/1/627578/627410/926882595/2ts+/westCoastFSEND/jdk-1.5.0_04 -oth-JPR/jdk-1.5.0_04-oth-JPR:3/jdk-1_5_0_04-windows-i586-p.exe(这是For Windows) 然后就是安装JDK,我是把它装到从c:\JDK目录下面: 然后就是CLASSPATH的问题了: 正如操作系统利用PATH来搜索可执行程序一样,Java运行环境也会遍历CLASSPATH来查找类,即便是HelloWorld这样简单的程序,JVM也会遍历 CLASSPATH定义的每一个路径,直到找到相应的文件为止。 相信大家用的系统不是2k就是XP,然后就应当如下设置Path: 我的电脑->属性->高级->环境变量 然后在环境变量的Path后面追加: C:\JDK\bin;.;C:\JDK\lib 也可以这样配置:C:\JDK\bin;.;C:\JDK\lib\dt.jar;C:\JDK\lib\tools.jar ★记住:环境变量中的 . 切记不能少,它表示当前路径,如果少掉出现的错误等会就说! dt.jar是关于运行环境的类库,tools.jar是关于一些工具的类库 如果没有配置:C:\JDK\bin,则会出现 " javac′ 不是内部或外部命令,也不是可运行的程序或批处理文件。"这样的错误。 然后下面就该写程序了: 首先是(HelloWorld.java),打开Editplus,新建一个Java文件,请照着如下输入,要一字不漏,并且分清大小写: public class HelloWorld{ public static void main(String[] args){ System.out.println("Hello,World!"); } } 然后把这个文件保存(ctrl + s)到HelloWorld.java,记住大小写一定要分清,是HelloWorld.java不是helloworld.java或者其它的 下面就该运行了,开始->运行->cmd 在控制台中把目录切换到当前目录: javac HelloWorld.java java HelloWorld 你就会在控制台上看见输出的Hello,World!(没出来?我把电脑吃了:)) javac是编译命令,它把HelloWorld.java编译成HelloWorld.class java就是解释命令,JVM把HelloWorld.class解释执行. 在这个时候: 1。如果出现Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld 那就是你在环境变量中没有加上那个.(dot) 2。如果出现Exception in thread "main" java.lang.NoSuchMethodError: main 或者HelloWorld.java:1: Public class helloworld must be defined in a file called "HelloWorld.java". 那就是你没有分清大小写的写入这个HelloWorld,或者保存得时候没有保存为HelloWorld.java 这个名字一定要跟public class的名字一样 对于环境变量的问题就说到这里,下面我先所说怎么在Editplus里面编译和运行,在Tools->参数设置->配置用户工具 1.添加工具(添加应用程序) 菜单文字:Compile Java Program 程序:C:\JDK\bin\javac.exe 参数:文件名称 初始目录:文件目录 2.添加工具(添加应用程序) 菜单文字:Run Java Program 程序:C:\JDK\bin\java.exe 参数:文件名称(不含扩展名) 初始目录:文件目录 工具组名称可以随便添,比如Debug Java Program 然后在Tools的下拉菜单中,你就会看见Compile Java Program以及Run Java Program这两个选项,以后你就可以利用ctrl + 1编译和ctrl +2运行程序了 下面就讨论Servlet的运行: 首先要运行Servlet,则需要JSP/Servlet container,我建议初学者用Tomcat Tomcat(最新版本5.5):http://apache.justdn.org/jakarta/tomcat-5/v5.5.9/bin/jakarta-tomcat-5.5.9.exe然后把这个压缩包解压到: C:\Tomcat 然后再配置环境变量: 添加三个系统变量: JAVA_HOME: C:\JDK TOMCAT_HOME: C:\Tomcat CLASSPATH: %JAVA_HOME%\lib;%TOMCAT_HOME%\lib Tomcat的环境变量就配置完毕了,下面检验Tomcat是否能够运行: 在控制台中转到C:\Tomcat\bin这个目录,运行startup,然后回出现一个窗口,连跳一大串东西,最后表示Server已经运行 在浏览器中输入http://localhost:8080,出现欢迎界面,则表示Tomcat没问题了 然后和上面一样,写入你的第一个Servlet import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><head><title>"); out.println("This is my first Servlet"); out.println("</title></head><body>"); out.println("<h1>Hello,World!</h1>"); out.println("</body></html>"); } } 然后照样用javac HelloWorld.java来编译这个文件,如果出现无法import javax.servlet.* 那么就是应该把C:\Tomcat\common\lib里面的servlet.jar(根据实际来看)文件拷贝到C:\JDK\jre\lib\ext中,再次编译,就没有问题了! 然后在Tomcat目录里面的C:\Tomcat\webapps\ROOT里面按如下的文件结构: ROOT\index.html ROOT\welcom.jsp ROOT\WEB-INF\lib\MyServlet.jar(如果你的servlet的.class打成了.jar文件,则放在lib下面) ROOT\WEB-INF\classes\HelloWorld.class(把上面生成的HelloWorld.class文件放在这个里面) 然后在浏览器中输入http://localhost:8080/servlet/HelloWorld,于是Server众望所归的报错了:Error 404--Not Found 怎么回事呢? Servlet必须使用C:\Tomcat\webapps\ROOT\WEB-INF这个目录下面的web.xml文件进行注册,用EP打开这个web.xml文件,在里面加入 <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorld</servlet-name> <url-pattern>/servlet/helloworld</url-pattern> </servlet-mapping> 这样的结构 <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> 表示指定包含的servlet类. 而以下的结构 <servlet-mapping> <servlet-name>HelloWorld</servlet-name> <url-pattern>/servlet/HelloWorld</url-pattern> </servlet-mapping> 表示指定HelloServlet应当映射到哪一种URL模式。 在修改web.xml完毕过后,重新启动Server,然后再输入http://localhost:8080/servlet/HelloWorld,那么偌大一个Hello,World!等着你呢。

2008-12-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除