PPLK: Eclipse3.1.2+Tomcat5.5.15+Lomboz+XDoclet+VE(待完善)

Eclipse3.1.2 + Tomcat5.5.15 +Lomboz+XDoclet
安装 | 配置 (Jsp | Servlet | JavaBean)
 
>  I> Download SoftWare
(All in one) + Tomcatplugin + XDoclet-1.2.3;
(admin | compat | deployer | .) --- 解压到同一目录下.
Eclipse plugins: (安装: Copy | links)
Lomboz:       http://download.forge.objectweb.org/lomboz/ (version!)
Myeclipse:          http://www.myeclipseide.com
(E3.1.2+emf-sdo-runtime.2.1.0 + lomboz.3.1Rc + XDoclet-1.2.3)

>  II> Deploy
 Jdk: (SEV)
         JAVA_HOME =jdk.path
         CLASSPATH=.;%JAVA_HOME%/lib/dt.jar;
%JAVA_HOME%/lib/tool.jar;
         PATH=%JAVA_HOME%/bin;
 Tomcat: (SEV)
    CATALINA_HOME=tomcat.path;
         CATALINA_BASE =tomcat.path;
         CLASSPATH: %CATALINA_HOME%/common/lib/servlet.jar;

建立自己的 webapp 目录:
a> webapps目录下新建一个目录,起名叫myapps
b> myapps下新建一个目录WEB-INF, 注意大小写;
c> 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>
 
产生一下结构:
G:/TOMCAT/webapps/myapps/WEB-INF/classes lib;
G:/TOMCAT/webapps/myapps下即可运行jsp!
{
     建立非 webapps 下的目录: ( 在 </host>前加上)
    <Context path="/pp" docBase="myapps.path" debug="0"
    reloadable="true" ></Context> Over!
}

完成第一个 servelet 程序:
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();
   }
}
 
产生以下结构:
G:/TOMCAT/webapps/myapps/classes/test/Test.class
修改webapps/myapp/WEB-INF/web.xml,添加servletservlet-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>
<这一段声明了你要调用的Servletservlet-mapping则是将声明的servlet"映射"到地址/Test>

建立自己的 Bean:
package test;
public class TestBean{
    private String name = null;
    public TestBean(String strName){
         this.name=strName;
    }
    public void setName(String strName){
         this.name=strName;
    }
    public String getName(){
    return this.name;
    }
}
产生以下结构:
G:/TOMCAT/webapps/myapps/classes/test/TestBean.class
新建一个 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>
 
至此, Tomcat下的 Jsp | Servlet | JavaBean 的配置已经完成!


 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值