扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共19页)
JAVA_HOME=c:\j2sdk1.5.0 classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;(.;一定不能少,因为它代表当前路径) path=%JAVA_HOME%\bin |
public class Test{ public static void main(String args[]){ System.out.println("This is a test program."); } } |
javac Test.java java Test |
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet.jar; |
<?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> |
<html> <body> <center> Now time is: <%=new java.util.Date()%> </center> </body> </html> |
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(); } } } |
<?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> |
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; } } |
<%@ 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> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者