??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲高清国产拍精品26u,久久99精品久久久久久久久久,偷偷www综合久久久久久久 http://www.aygfsteel.com/jdyao/archive/2006/03/16/35728.html襉K村里?/dc:creator>襉K村里?/author>Thu, 16 Mar 2006 14:57:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/16/35728.htmlhttp://www.aygfsteel.com/jdyao/comments/35728.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/16/35728.html#Feedback2http://www.aygfsteel.com/jdyao/comments/commentRss/35728.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/35728.html
1、开发标{֟c:
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
import java.io.Writer;
import java.util.Iterator;
import java.util.LinkedList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
public abstract class AbstractTag extends BodyTagSupport {

    protected String templateName ;

    private final static String templatePath = "/WEB-INF/tags/";

    private static final long serialVersionUID = -1201668454354226175L;

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    protected String getBody() {
        if (bodyContent == null) {
            return "";
        } else {
            return bodyContent.getString().trim();
        }
    }
   
    protected abstract void prepareData ();

    public int doEndTag() throws JspException {
        try {
            prepareData ();
            include(templatePath + this.getTemplateName(), pageContext.getOut(),
                    pageContext.getRequest(),
                    (HttpServletResponse) pageContext.getResponse());

        } catch (Exception e) {
            // e.printStackTrace();
            throw new JspException(e);
        }
        return EVAL_BODY_INCLUDE;
    }

    public int doStartTag() throws JspException {
        try {
            pageContext.getOut().write(getBody());
        } catch (IOException e) {
            throw new RuntimeException("IOError: " + e.getMessage(), e);
        }
        return EVAL_PAGE;
    }

    public static void include(String aResult, Writer writer,ServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        String resourcePath = aResult;
        RequestDispatcher rd = request.getRequestDispatcher(resourcePath);
        if (rd == null) {
            throw new ServletException("Not a valid resource path:"
                    + resourcePath);
        }
        // Include the resource
        PageResponse pageResponse = new PageResponse(response);

        // Include the resource
        rd.include((HttpServletRequest) request, pageResponse);

        // write the response back to the JspWriter, using the correct encoding.
        String encoding = "GB2312";

        if (encoding != null) {
            // use the encoding specified in the property file
            pageResponse.getContent().writeTo(writer, encoding);
        } else {
            // use the platform specific encoding
            pageResponse.getContent().writeTo(writer, null);
        }
    }

    static final class PageResponse extends HttpServletResponseWrapper {

        protected PrintWriter pagePrintWriter;

        protected ServletOutputStream outputStream;

        private PageOutputStream pageOutputStream = null;

        /**
         * Create PageResponse wrapped around an existing HttpServletResponse.
         */
        public PageResponse(HttpServletResponse response) {
            super(response);
        }

        /**
         * Return the content buffered inside the {@link PageOutputStream}.
         *
         * @return
         * @throws IOException
         */
        public FastByteArrayOutputStream getContent() throws IOException {
            // if we are using a writer, we need to flush the
            // data to the underlying outputstream.
            // most containers do this - but it seems Jetty 4.0.5 doesn't
            if (pagePrintWriter != null) {
                pagePrintWriter.flush();
            }

            return ((PageOutputStream) getOutputStream()).getBuffer();
        }

        /**
         * Return instance of {@link PageOutputStream} allowing all data written
         * to stream to be stored in temporary buffer.
         */
        public ServletOutputStream getOutputStream() throws IOException {
            if (pageOutputStream == null) {
                pageOutputStream = new PageOutputStream();
            }

            return pageOutputStream;
        }

        /**
         * Return PrintWriter wrapper around PageOutputStream.
         */
        public PrintWriter getWriter() throws IOException {
            if (pagePrintWriter == null) {
                pagePrintWriter = new PrintWriter(new OutputStreamWriter(
                        getOutputStream(), getCharacterEncoding()));
            }

            return pagePrintWriter;
        }
    }

    static final class PageOutputStream extends ServletOutputStream {

        private FastByteArrayOutputStream buffer;

        public PageOutputStream() {
            buffer = new FastByteArrayOutputStream();
        }

        /**
         * Return all data that has been written to this OutputStream.
         */
        public FastByteArrayOutputStream getBuffer() throws IOException {
            flush();

            return buffer;
        }

        public void close() throws IOException {
            buffer.close();
        }

        public void flush() throws IOException {
            buffer.flush();
        }

        public void write(byte[] b, int o, int l) throws IOException {
            buffer.write(b, o, l);
        }

        public void write(int i) throws IOException {
            buffer.write(i);
        }

        public void write(byte[] b) throws IOException {
            buffer.write(b);
        }
    }
   
   
    static public class FastByteArrayOutputStream extends OutputStream {

        // Static --------------------------------------------------------
        private static final int DEFAULT_BLOCK_SIZE = 8192;


        private LinkedList buffers;

        // Attributes ----------------------------------------------------
        // internal buffer
        private byte[] buffer;

        // is the stream closed?
        private boolean closed;
        private int blockSize;
        private int index;
        private int size;


        // Constructors --------------------------------------------------
        public FastByteArrayOutputStream() {
            this(DEFAULT_BLOCK_SIZE);
        }

        public FastByteArrayOutputStream(int aSize) {
            blockSize = aSize;
            buffer = new byte[blockSize];
        }


        public int getSize() {
            return size + index;
        }

        public void close() {
            closed = true;
        }

        public byte[] toByteArray() {
            byte[] data = new byte[getSize()];

            // Check if we have a list of buffers
            int pos = 0;

            if (buffers != null) {
                Iterator iter = buffers.iterator();

                while (iter.hasNext()) {
                    byte[] bytes = (byte[]) iter.next();
                    System.arraycopy(bytes, 0, data, pos, blockSize);
                    pos += blockSize;
                }
            }

            // write the internal buffer directly
            System.arraycopy(buffer, 0, data, pos, index);

            return data;
        }

        public String toString() {
            return new String(toByteArray());
        }

        // OutputStream overrides ----------------------------------------
        public void write(int datum) throws IOException {
            if (closed) {
                throw new IOException("Stream closed");
            } else {
                if (index == blockSize) {
                    addBuffer();
                }

                // store the byte
                buffer[index++] = (byte) datum;
            }
        }

        public void write(byte[] data, int offset, int length) throws IOException {
            if (data == null) {
                throw new NullPointerException();
            } else if ((offset < 0) || ((offset + length) > data.length) || (length < 0)) {
                throw new IndexOutOfBoundsException();
            } else if (closed) {
                throw new IOException("Stream closed");
            } else {
                if ((index + length) > blockSize) {
                    int copyLength;

                    do {
                        if (index == blockSize) {
                            addBuffer();
                        }

                        copyLength = blockSize - index;

                        if (length < copyLength) {
                            copyLength = length;
                        }

                        System.arraycopy(data, offset, buffer, index, copyLength);
                        offset += copyLength;
                        index += copyLength;
                        length -= copyLength;
                    } while (length > 0);
                } else {
                    // Copy in the subarray
                    System.arraycopy(data, offset, buffer, index, length);
                    index += length;
                }
            }
        }

        // Public
        public void writeTo(OutputStream out) throws IOException {
            // Check if we have a list of buffers
            if (buffers != null) {
                Iterator iter = buffers.iterator();

                while (iter.hasNext()) {
                    byte[] bytes = (byte[]) iter.next();
                    out.write(bytes, 0, blockSize);
                }
            }

            // write the internal buffer directly
            out.write(buffer, 0, index);
        }

        public void writeTo(RandomAccessFile out) throws IOException {
            // Check if we have a list of buffers
            if (buffers != null) {
                Iterator iter = buffers.iterator();

                while (iter.hasNext()) {
                    byte[] bytes = (byte[]) iter.next();
                    out.write(bytes, 0, blockSize);
                }
            }

            // write the internal buffer directly
            out.write(buffer, 0, index);
        }

        public void writeTo(Writer out, String encoding) throws IOException {
            // Check if we have a list of buffers
            if (buffers != null) {
                Iterator iter = buffers.iterator();

                while (iter.hasNext()) {
                    byte[] bytes = (byte[]) iter.next();

                    if (encoding != null) {
                        out.write(new String(bytes, encoding));
                    } else {
                        out.write(new String(bytes));
                    }
                }
            }

            // write the internal buffer directly
            if (encoding != null) {
                out.write(new String(buffer, 0, index, encoding));
            } else {
                out.write(new String(buffer, 0, index));
            }
        }

        /**
         * Create a new buffer and store the
         * current one in linked list
         */
        protected void addBuffer() {
            if (buffers == null) {
                buffers = new LinkedList();
            }

            buffers.addLast(buffer);

            buffer = new byte[blockSize];
            size += index;
            index = 0;
        }
    }
}

2、定义一个具体的标签c?br> public class ListTag extends RiseAbstractTag {

    private static final long serialVersionUID = 3385568988234498913L;

    protected String templateName = "list.jsp";

    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    protected void prepareData() {
        this.setTemplateName(this.templateName);
        pageContext.getRequest().setAttribute("id", this.id);
    }
}

3、定义TLD文g
   参考TLD文档
4、定义list.jsp模板
<%@ page contentType="text/html; charset=GBK" %>

<%
String id = (String)request.getAttribute("id");
%>
<table width="90%" border="0" cellpadding="0" cellspacing="2">

  <tr>
    <td>Id</td>
    <td align="right"><%= id %></td>
  </tr>
</table>
5、用默认模?br>    <WWTag:list id="Hello WorldQ?/>
6、用自定义模板
   a: 定义模板
<%@ page contentType="text/html; charset=GBK" %>

<%
String id = (String)request.getAttribute("id");
out.println("Id is : " + id);
%>
   b: use it , 模板名:testList.jspQ放?WEB-INF/tags目录?br>    <WWTag:list id="Hello WorldQ? templateName="testList.jsp"/>




]]>
团队在局域网中共享ADSLҎ(windows, linux)http://www.aygfsteel.com/jdyao/archive/2006/03/16/35658.html襉K村里?/dc:creator>襉K村里?/author>Thu, 16 Mar 2006 07:31:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/16/35658.htmlhttp://www.aygfsteel.com/jdyao/comments/35658.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/16/35658.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/35658.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/35658.html    1、windows下共享非常简单,把ADSL׃n卛_Q但不要把每一个连接都拨号l选上Q否则无法用。此时局域网内IP地址?92.168.0.1--192.168.0.2XX之间。问题是Q容易坏Q不E_。随改用Linux?br>    2、Linux环境下用。Red Hat Linux ES3版本。(文档来自|络攉Q共享大家用)

http://www.chinalinuxpub.com/read.php?wid=558

 

 

1?|卡配置?/span>
我这里用的网卡是RTL8029?span lang="EN-US">3com905。在pȝ中,RTL8029标记?span lang="EN-US">eth0
Q?span lang="EN-US">3com905标记?span lang="EN-US">eth1?span lang="EN-US">RTL8029?span lang="EN-US">3com905?span lang="EN-US">IP地址分别?span lang="EN-US">192.168.0.1?span lang="EN-US">192.168.1.1Q其他的地址也可Q,掩码均ؓ255.255.255.0?/span>
eth0用于q接|通,eth1用于q接内网Q局域网|段?span lang="EN-US">192.168.0.0?/span>
注意Q此处两块网卡均不能讄兟?/span>
2?span lang="EN-US"> PPPoE软g的升U与安装

1Q??http://www.roaringpenguin.com/pppoe/#download 下蝲
2Q?安装rp-pppoe。以rootw䆾执行
rpm ?span lang="EN-US">Uvh rp-pppoe-3.5-1.i386.rpm
3?修改/etc/ sysctl.conf
其中的
net.ipv4.ip_forward = 0
改ؓ
net.ipv4.ip_forward = 1
4?去除ipchains模块Q只选择iptablesҎ如下Q?/span>
1Q?span lang="EN-US">setup

2Q选择system service
3Q去?span lang="EN-US">ipchains
4Q选中iptables
5Q重启机?/span>
5?span lang="EN-US"> PPPoE客户端配|?/span>
?span lang="EN-US">rp-pppoe-3.5-1.i386.rpm安装完毕后,接下来就可进?span lang="EN-US">PPPoE
客户端配|了。过E如下?/span>
#/usr/sbin/adsl-setup
>>> Enter your PPPoE user name: ——此处输入拨号帐L用户?/span>
>>> Enter the Ethernet interface connected to the ADSL modem For Solaris, this is likely to be something like /dev/hme0. For Linux, it will be ethn, where 'n' is a number. (default eth0): ——输eth0
>>> Enter the demand value (default no): ——输no
>>> Enter the DNS information here: ——输210.83.130.18
>>> Please enter your PPPoE password: ——输|通用户口?/span>
>>> Choose a type of firewall (0-2): ——输0
>>> Accept these settings and adjust configuration files (y/n)? ——输y
6?启动拨号q接
/usr/sbin/adsl-start
成功q接后,屏幕昄Connected?/span>
此时q台linux已可以上|浏览了?/span>
7?span lang="EN-US"> IP伪装

Z使局域网中的其他机器能通过Linux服务器共享上|,臛_L行下面的命oQ?/span>
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
完成后,?span lang="EN-US">192.168.0.0|段Q网关ؓ192.168.0.1Q的PC机就可透过Linux上网了!

8?开启动
Z?span lang="EN-US">Linux服务器能够自动拨P执行下面步骤?/span>
1Q?span lang="EN-US">chkconfig --add adsl

2Q?span lang="EN-US">setup

3Q选择system services
4Q选中ADSL
5Q?span lang="EN-US">OK退?/span>
6Q打开/etc/rc.d/rc.localQ在该文件的末尾M下面语句
echo "[OK]"
echo "Drop ICMP form anywhere"
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "[OK]"
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
说明Q前面四句用于关?span lang="EN-US">ICMPQ防止别?span lang="EN-US">Ping
?/span>
9?xQ一?span lang="EN-US">OKQ一个简单的拨号建成了。重启机器后Q发?span lang="EN-US">linux?span lang="EN-US">internet׃nq接已经一切就l了Q好妙!Q!

Z建立更安全的拨号q接Q请再设|各U安全机制吧Q好事多嘛?/span>
另外Q如果网兛_面的客户机无法通过linux上网Q请留意一?span lang="EN-US">linux的防火墙讄?/span>

REDHAT9?/span>ADSL最l解x?/span>

 

发布?/span>2005-05-29 被读559?/span> 【字体:?/span> ?/span> ?/span>

 

?/span>LINUXSIR?/span>LINUXFANS上看了很多关?/span>ADSL的文?/span>,都没有解x?/span>REDHAT9?/span>ADSL上网的问?/span>,今天实在是没有办?/span>,重新建立q接,曲折的经?/span>,l于上网?/span>(非常Ȁ?/span>,可能表达的不是很?/span>),特的写下我的q程,作ؓ参?/span>:

 

REDHAT默认?/span>PPPOE有问?/span>,需?/span>RPM -E,然后,安装q个 --实际在RedES3上没必要按照q个׃n包?/font>

http://www.roaringpenguin.com/pppoe/rp-pppoe-3.5.tar.gz(北南兄推?/span>)

解压和安装:

#tar zxvf rp-pppoe-3.5.tar.gz

q入解压目录执行

#sh ./go

 

 

然后再来讄ADSL。这一处,我们要用命o?/span>

 

#adsl-setup

 

 

Welcome to the Roaring Penguin ADSL client setup. First, I will run

some checks on your system to make sure the PPPoE client is installed

properly...

 

Looks good! Now, please enter some information:

 

USER NAME

 

>>> Enter your PPPoE user name (default XXX): 在这里输?/span>ADSL的用户名

 

INTERFACE

 

>>> Enter the Ethernet interface connected to the ADSL modem

For Solaris, this is likely to be something like /dev/hme0.

For Linux, it will be ethn, where 'n' is a number.

(default eth0):如果一张网卡就讄写上eth0

 

Do you want the link to come up on demand, or stay up continuously?

If you want it to come up on demand, enter the idle time in seconds

after which the link should be dropped. If you want the link to

stay up permanently, enter 'no' (two letters, lower-case.)

NOTE: Demand-activated links do not interact well with dynamic IP

addresses. You may have some problems with demand-activated links.

>>> Enter the demand value (default no):不用写什?/span>

 

DNS

Please enter the IP address of your ISP's primary DNS server.

If your ISP claims that 'the server will provide DNS addresses',

enter 'server' (all lower-case) here.

If you just press enter, I will assume you know what you are

doing and not modify your DNS setup.

>>> Enter the DNS information here:在这里写?/span>202.96.134.133

下一?/span>DNS?/span>202.96.168.68 //q里Ҏ个h不同可以修改

 

PASSWORD

 

>>> Please enter your PPPoE password:输入密码

>>> Please re-enter your PPPoE password:再输入一?/span>

 

FIREWALLING

 

Please choose the firewall rules to use. Note that these rules are

very basic. You are strongly encouraged to use a more sophisticated

firewall setup; however, these will provide basic security. If you

are running any servers on your machine, you must choose 'NONE' and

set up firewalling yourself. Otherwise, the firewall rules will deny

access to all standard servers like Web, e-mail, ftp, etc. If you

are using SSH, the rules will block outgoing SSH connections which

allocate a privileged source port.

 

The firewall choices are:

0 - NONE: This script will not set any firewall rules. You are responsible

for ensuring the security of your machine. You are STRONGLY

recommended to use some kind of firewall rules.

1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation

2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway

for a LAN

>>> Choose a type of firewall (0-2):q里d?/span>2

 

** Summary of what you entered **

 

Ethernet Interface: eth0

User name: XXX

Activate-on-demand: No

DNS: Do not adjust

Firewalling: MASQUERADE

 

>>> Accept these settings and adjust configuration files (y/n)?

 

弄完后,按一?/span>y键?/span>

(以上为北南兄文章里面内容)

不要急于q接,REBOOT -N

然后q入|络讄,停止ETH1(我的是用?/span>)

然后ADSL-START

PING 你的DNS,如果可以,那么,恭喜?/span>!

其中部分内容可能不同,仅作参?/span>,主要在连接后,能够PING?/span>DNS卛_!

 

 

 

==========================================================================

首先应该定您是否安装了pppoe的应用程序?/span>

 

  如果实已经安装了,可以在终端用 adslQ?/span>setup命o启动adsl配置Q提CEؓ英文?/span>

 

  大概?/span>:

 

[root@localhost root]# adsl-setup

Welcome to the ADSL client setup. First, I will run some checks on

your system to make sure the PPPoE client is installed properly...

 

The following DSL config was found on your system:

 

Device: Name:

ppp0 DSLppp0

 

Please enter the device if you want to configure the present DSL config

(default ppp0) or enter 'n' if you want to create a new one: ppp0 //默认?/span>ppp0

 

LOGIN NAME

 

Enter your Login Name (default SJ00411210A1): anthrax //q里用你自己的用户名代替我的anthrax:)

 

INTERFACE

 

Enter the Ethernet interface connected to the ADSL modem

For Solaris, this is likely to be something like /dev/hme0.

For Linux, it will be ethX, where 'X' is a number.

(default eth0): eth0 //默认|卡讑֤?/span>eth0

 

Do you want the link to come up on demand, or stay up continuously?

If you want it to come up on demand, enter the idle time in seconds

after which the link should be dropped. If you want the link to

stay up permanently, enter 'no' (two letters, lower-case.)

NOTE: Demand-activated links do not interact well with dynamic IP

addresses. You may have some problems with demand-activated links.

Enter the demand value (default no): no //q里使用默认no可以了Q断U后不自动拨受?/span>

 

 

DNS

 

Please enter the IP address of your ISP's primary DNS server.

If your ISP claims that 'the server will provide dynamic DNS addresses',

enter 'server' (all lower-case) here.

If you just press enter, I will assume you know what you are

doing and not modify your DNS setup.

Enter the DNS information here: 202.96.134.133 //?/span>DNS地址讄Q根据您的具体情冉|换?/span>

Please enter the IP address of your ISP's secondary DNS server.

If you just press enter, I will assume there is only one DNS server.

Enter the secondary DNS server address here: 202.96.134.133 //W二DNS地址讄?/span>

 

PASSWORD

 

Please enter your Password: //q里讄密码Q和unix规则一P密码q不回显Q因此不要认为您的键盘出了毛?/span>:)

Please re-enter your Password:

//认密码

USERCTRL

 

Please enter 'yes' (two letters, lower-case.) if you want to allow

normal user to start or stop DSL connection (default yes): yes //是否允许普通用户共?/span>ADSL?/span>

 

FIREWALLING

 

Please choose the firewall rules to use. Note that these rules are

very basic. You are strongly encouraged to use a more sophisticated

firewall setup; however, these will provide basic security. If you

are running any servers on your machine, you must choose 'NONE' and

set up firewalling yourself. Otherwise, the firewall rules will deny

access to all standard servers like Web, e-mail, ftp, etc. If you

are using SSH, the rules will block outgoing SSH connections which

allocate a privileged source port.

 

The firewall choices are:

0 - NONE: This script will not set any firewall rules. You are responsible

for ensuring the security of your machine. You are STRONGLY

recommended to use some kind of firewall rules.

1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation

2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway

for a LAN

Choose a type of firewall (0-2): 1 //配置防火墙等U,Ҏ您的需要选择?/span>

 

Start this connection at boot time

 

Do you want to start this connection at boot time?

Please enter no or yes (default no):no //是否允许开动加载,q里选择noQ否则系l启动速度太慢!

 

** Summary of what you entered **

 

Ethernet Interface: eth0

User name: anthrax

Activate-on-demand: No

Primary DNS: 202.96.134.133

Secondary DNS: 202.96.134.133

Firewalling: STANDALONE

User Control: yes

Accept these settings and adjust configuration files (y/n)?

 

 

  选择yQ配|完成。您可以?/span> adslQ?/span>start命o启动Q可以用adslQ?/span>stop命o停止?/span>

 

  Z方便Q可以在桌面建立一个应用程序链接,命o׃?/span>adslQ?/span>start。这hơ双击那个快捷图标就可以建立adsl链接了,?/span>windows中一hѝ?/span>

 

好了Q现在就开始您的网l之旅吧?/span>(技?/span>:如果依据本内Ҏ作扔不能链接|络Q可以尝试在"pȝ讄Q?/span>>|\"中删除当前的|卡Q重新配|?/span>adslV?/span>)




]]>
Eclipse CVS 在局域网中与防火墙共?/title><link>http://www.aygfsteel.com/jdyao/archive/2006/03/16/35655.html</link><dc:creator>襉K村里?/dc:creator><author>襉K村里?/author><pubDate>Thu, 16 Mar 2006 07:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/jdyao/archive/2006/03/16/35655.html</guid><wfw:comment>http://www.aygfsteel.com/jdyao/comments/35655.html</wfw:comment><comments>http://www.aygfsteel.com/jdyao/archive/2006/03/16/35655.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/jdyao/comments/commentRss/35655.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/jdyao/services/trackbacks/35655.html</trackback:ping><description><![CDATA[    在打开windows|络防火墙的情况下,cvs的验证过E非常慢Q几乎难以忍受。关闭防火墙虽然比较快捷Q但计算机的安全性受到考验?br>     Ҏ1、用天|等防火墙品,允许所有低端端口,允许局域网讉K所有端口。注Q此时它关闭了Windows的防火墙Q用自己提供的功能?br>     Ҏ2、Windows配置Q打开113Q?401在局域网范围内的TCP端口?br> <img src ="http://www.aygfsteel.com/jdyao/aggbug/35655.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/jdyao/" target="_blank">襉K村里?/a> 2006-03-16 15:11 <a href="http://www.aygfsteel.com/jdyao/archive/2006/03/16/35655.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>补充Q?Hibernate XDoclet 在Eclipse中的模版随笔)http://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.html襉K村里?/dc:creator>襉K村里?/author>Sun, 12 Mar 2006 07:38:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.htmlhttp://www.aygfsteel.com/jdyao/comments/34911.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34911.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/34911.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/34911.htmlHibernate XDoclet 在Eclipse中的模版
补充Q?a id="CategoryEntryList1_EntryStoryList_Entries__ctl0_TitleUrl" href="../articles/34910.html">Hibernate对象兌--UML基础知识、XDoclet---- 5 XDoclet Template In Eclipse
      (pd内容参看Q?a HREF="/jdyao/category/8354.html">览)


]]>
一些Java技术网?-四处攉--没有分类http://www.aygfsteel.com/jdyao/archive/2006/03/12/34908.html襉K村里?/dc:creator>襉K村里?/author>Sun, 12 Mar 2006 06:34:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34908.htmlhttp://www.aygfsteel.com/jdyao/comments/34908.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/12/34908.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/34908.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/34908.htmlhttp://www.javaalmanac.com - Java开发者年鉴一书的在线版本. 要想快速查到某UJava技巧的用法及示例代? q是一个不错的d.
http://www.onjava.com - O'Reilly的Java|站. 每周都有新文?
http://java.sun.com - 官方的Java开发者网?- 每周都有新文章发?
http://www.developer.com/java - 由Gamelan.com l护的Java技术文章网?
http://www.java.net - Sun公司l护的一个JavaC֌|站.
http://www.builder.com - Cnet的Builder.com|站 - 所有的技术文? 以JavaZ.
http://www.ibm.com/developerworks/java - IBM的Developerworks技术网? q是其中的Java技术主?
http://www.javaworld.com - 最早的一个Java站点. 每周更新Java技术文?
http://www.devx.com/java - DevXl护的一个Java技术文章网?
http://www.fawcette.com/javapro - JavaPro在线杂志|站.
http://www.sys-con.com/java - Java Developers Journal的在U杂志网?
http://www.javadesktop.org - 位于Java.net的一个Java桌面技术社区网?
http://www.theserverside.com - q是一个讨论所有Java服务器端技术的|站.
http://www.jars.com - 提供Java评论服务. 包括各种framework和应用程?
http://www.jguru.com - 一个非常棒的采用Q&A形式的Java技术资源社?
http://www.javaranch.com - 一个论坛,得到Java问题{案的地方,初学者的好去处?
http://www.ibiblio.org/javafaq/javafaq.html - comp.lang.java的FAQ站点 - 攉了来自comp.lang.java新闻l的问题和答案的分类目录.
http://java.sun.com/docs/books/tutorial/ - 来自SUN公司的官方Java指南 - 对于了解几乎所有的java技术特性非常有帮助.
http://www.javablogs.com - 互联|上最z跃的一个Java Blog|站.
http://java.about.com/ - 来自About.com的Java新闻和技术文章网?
http://www.codechina.net 提供大量的java源代码及教程?img src ="http://www.aygfsteel.com/jdyao/aggbug/34908.html" width = "1" height = "1" />

]]>
Hibernate XDoclet 在Eclipse中的模版http://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.html襉K村里?/dc:creator>襉K村里?/author>Thu, 09 Mar 2006 16:28:00 GMThttp://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.htmlhttp://www.aygfsteel.com/jdyao/comments/34577.htmlhttp://www.aygfsteel.com/jdyao/archive/2006/03/10/34577.html#Feedback0http://www.aygfsteel.com/jdyao/comments/commentRss/34577.htmlhttp://www.aygfsteel.com/jdyao/services/trackbacks/34577.htmlҎ1Q?/b>
OOcd--〉数据库设计--〉MiddleGen (能够处理基本的关联关p?-打开XDoclet标签生成开养I但不能处理承概念,较ؓ遗憾ing)-->在Eclipse手工更新JavacM 的XDoclet标签Q然后XDoclet生成Hbm文g。当然了再写个JUnit试一下关联关pL否正,必要的Lazy是否标注?/font>

下蝲TemplateQ?http://raibledesigns.com/wiki/Wiki.jsp?page=XDocletEclipse#hibcolidx 非常感谢MattRaible.

在中文环境中Qwindow xp的字W切换键与Eclipse模版的字W快捷键重合Q需要修改之。ؓ了避免麻烦,直接修改Template文gQ简单添加@标示W:全文如下Q?br><?xml version="1.0" encoding="UTF-8"?>
<templates>
    <template name="@hibarray" description="@hibernate.array" context="javadoc" enabled="true">@hibernate.array table=&quot;&quot; cascade=&quot;save-update&quot;</template>
    <template name="@hibbag" description="@hibernate.bag" context="javadoc" enabled="true">@hibernate.bag table=&quot;&quot; lazy=&quot;false&quot; cascade=&quot;none&quot; inverse=&quot;false&quot;</template>
    <template name="@hibclass" description="@hibernate.class" context="javadoc" enabled="true">@hibernate.class table=&quot;${enclosing_type}&quot;</template>
    <template name="@hibcolelm" description="@hibernate.collection-element" context="javadoc" enabled="true">@hibernate.collection-element column=&quot;&quot; type=&quot;&quot; length=&quot;&quot;</template>
    <template name="@hibcolidx" description="@hibernate.collection-index" context="javadoc" enabled="true">@hibernate.collection-index column=&quot;&quot; type=&quot;&quot; length=&quot;&quot;</template>
    <template name="@hibcolkey" description="@hibernate.collection-key" context="javadoc" enabled="true">@hibernate.collection-key column=&quot;&quot; generator-class=&quot;native&quot;</template>
    <template name="@hibcolmtm" description="@hibernate.many-to-many" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;link_table_name_here&quot; cascade=&quot;save-update&quot; inverse=&quot;true|false&quot; lazy=&quot;true&quot;
     * @hibernate.collection-key column=&quot;${enclosing_type}_ID&quot;
     * @hibernate.collection-many-to-many class=&quot;relationship_class_the_set_contains&quot; column=&quot;relationship_foreign_key&quot;
     * @return ${return_type}</template>
    <template name="@hibcolotm" description="@hibernate.one-to-many relationship" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;relationship_table&quot;
     *                     sort=&quot;comparator_class&quot; inverse=&quot;true|false&quot;
     *                     cascade=&quot;save-update&quot; lazy=&quot;true&quot;
     * @hibernate.collection-key column=&quot;${enclosing_type}_ID&quot;
     * @hibernate.collection-one-to-many class=&quot;relationship_class&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibcomelm" description="@hibernate.collection-composite-element" context="javadoc" enabled="true">@hibernate.collection-composite-element class=&quot;&quot;</template>
    <template name="@hibcomp" description="@hibernate.component" context="javadoc" enabled="true">@hibernate.component class=&quot;component_class_name&quot;</template>
    <template name="@hibdisc" description="@hibernate.discriminator" context="javadoc" enabled="true">@hibernate.discriminator column=&quot;subclass&quot; type=&quot;character&quot;</template>
    <template name="@hibid" description="@hibernate.id" context="javadoc" enabled="true">Note: unsaved-value An identifier property value that indicates that an instance
     * is newly instantiated (unsaved), distinguishing it from transient instances that
     * were saved or loaded in a previous session.  If not specified you will get an exception like this:
     * another object associated with the session has the same identifier
     *
     * @hibernate.id generator-class=&quot;&quot; type=&quot;${return_type}&quot; column=&quot;${enclosing_type}_ID&quot;
     * unsaved-value=&quot;null&quot; length=&quot;&quot;
     * @return ${return_type}</template>
    <template name="@hiblist" description="@hibernate.list" context="javadoc" enabled="true">@hibernate.list table=&quot;relationship-table&quot; lazy=&quot;false&quot; cascade=&quot;none&quot;</template>
    <template name="@hibmap" description="@hibernate.map" context="javadoc" enabled="true">@hibernate.map name=&quot;${enclosing_method}&quot; table=&quot;relationship-table&quot; lazy=&quot;false&quot; cascade=&quot;none&quot;</template>
    <template name="@hibmto" description="@hibernate.many-to-one" context="javadoc" enabled="true">@hibernate.many-to-one column=&quot;${return_type}_ID&quot; class=&quot;package.${return_type}&quot;
     *
     * @return ${return_type}
     *</template>
    <template name="@hiboto" description="@hibernate.one-to-one" context="javadoc" enabled="true">hibernate.one-to-one cascade=&quot;none&quot; class=&quot;&quot; outer-join=&quot;auto&quot;</template>
    <template name="@hibprimarr" description="@hibernate.primitive-array" context="javadoc" enabled="true">@hibernate.primitive-array table=&quot;&quot; cascade=&quot;none&quot;</template>
    <template name="@hibprop" description="@hibernate.property" context="javadoc" enabled="true">@hibernate.property name=&quot;${enclosing_method}&quot; column=&quot;${enclosing_method}&quot; type=&quot;${return_type}&quot; not-null=&quot;false&quot; unique=&quot;false&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibquery" description="@hibernate.query" context="javadoc" enabled="true">@hibernate.query name=&quot;&quot; query=&quot;&quot;</template>
    <template name="@hibset" description="@hibernate.set" context="javadoc" enabled="true">@hibernate.set name=&quot;${enclosing_method}&quot; table=&quot;relationship_table&quot;
     *                     sort=&quot;comparator_class&quot; inverse=&quot;true&quot;
     *                     cascade=&quot;save-update&quot; lazy=&quot;true&quot;</template>
    <template name="@hibsubc" description="@hibernate.subclass" context="javadoc" enabled="true">@hibernate.subclass name=&quot;&quot; discriminator-value=&quot;&quot;</template>
    <template name="@hibts" description="@hibernate.timestamp" context="javadoc" enabled="true">@hibernate.timestamp column=&quot;${enclosing_method}&quot;
     *
     * @return ${return_type}</template>
    <template name="@hibver" description="@hibernate.version" context="javadoc" enabled="true">@hibernate.version column=&quot;${enclosing_method}&quot;
     *
     * @return ${return_type}</template>
</templates>

使用Ӟ先把XML内容单独保存为文Ӟ然后在Eclipse-->Windows-->Preferences
                                     在Preferences-->Java-->Editor-->Templates 点击Import按钮导入之前已经保存的XML文g?br>
Ҏ2Q?br>
OOcd--〉在Eclipse手工~写属?-〉生成Get/SetҎ--〉更新JavacM 的XDoclet标签Q然后XDoclet生成Hbm文g。当然了再写个JUnit试一下关联关pL否正,必要的Lazy是否标注?br>要求先修改GetҎ的模板:源代码编辑器中鼠标右?-〉Source--〉Generate Getters And Setters..
bb.PNG
                      
               点击打开面板中Code Template链接?br>aa1.PNG

~辑GetterҎ模板Q?br>/**
 * @hibernate.property name="${bare_field_name}" column="${field}" type="${field_type}" not-null="false" unique="false" length="128"
 * @return Returns the ${bare_field_name}.
 */
然后生成代码Q手工微调部分属性。也能够节约大量旉?br>
注意Q在~写Java POJOcLQjava属性用完整的带包名的类Q例如:
/**
* @author jdyao
 * @hibernate.class table="respri"
 * @version
 */
public class Resource implements Serializable {

    private static final long serialVersionUID = 1505581058179605003L;

    private java.lang.String guid;

    private java.lang.String context;

 

    public
Resource () {

    }

    /**
     * @return java.lang.String
     * @hibernate.property name="context" type="java.lang.String"
     *                     length="128"
     *
     */
    public java.lang.String getContext() {
        return context;
    }

    public void setContext(java.lang.String context) {
        this.context = context;
    }

    /**
     * @return java.lang.String
     * @hibernate.id generator-class="guid" type="java.lang.String" column="guid"
     *               unsaved-value="null" length="38"
     */
    public java.lang.String getGuid() {
        return guid;
    }

    public void setGuid(java.lang.String guid) {
        this.guid = guid;
    }

}
原因QXDoclet在生成的时候,如果type="string",有时会出现错误,无法生成Hbm文gQؓ了避免这个不必要的错误,务必要写全类名?br>
XDoclet build.xml文gQ?/b>

<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="XDoclet Examples" default="hibernate" basedir=".">
    <property name="xdoclet.root.dir" value="${basedir}"/>
    <property file="${xdoclet.root.dir}/build.properties"/>

    <!-- Include the build-dist properties. Since properties are immutable,
    this will not override available properties. You do not have to include
    this in your own build file. -->
    <property file="build-dist.properties"/>

    <!-- See CustomerBean. This is to demonstrate property substitution. -->
    <property name="ejb.prefix" value="blah"/>

    <!-- =================================================================== -->
    <!-- Define the class path                                               -->
    <!-- =================================================================== -->
    <path id="samples.class.path">
        <fileset dir="${lib.dir}">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${samples.lib.dir}">
            <include name="*.jar"/>
        </fileset>
        <fileset dir="${dist.lib.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>

    <!-- =================================================================== -->
    <!-- Initialise                                                          -->
    <!-- =================================================================== -->
    <target name="init">
        <tstamp>
            <format property="TODAY" pattern="d-MM-yy"/>
        </tstamp>
        <taskdef
            name="xdoclet"
            classname="xdoclet.DocletTask"
            classpathref="samples.class.path"
            />
         <taskdef
            name="hibernatedoclet"
            classname="xdoclet.modules.hibernate.HibernateDocletTask"
            classpathref="samples.class.path"
            />
    </target>


    <!-- =================================================================== -->
    <!-- Prepares the directory structure                                    -->
    <!-- =================================================================== -->
    <target name="prepare" depends="init">
        <mkdir dir="${samples.classes.dir}"/>
        <mkdir dir="${samples.gen-src.dir}"/>
        <mkdir dir="${samples.meta-inf.dir}"/>
    </target>



    <!-- =================================================================== -->
    <!-- Invoke XDoclet's hibernate                                          -->
    <!-- =================================================================== -->
    <target name="hibernate" depends="prepare" description="Generate mapping documents (run jar first)">

        <echo>+---------------------------------------------------+</echo>
        <echo>|                                                   |</echo>
        <echo>| R U N N I N G   H I B E R N A T E D O C L E T     |</echo>
        <echo>|                                                   |</echo>
        <echo>+---------------------------------------------------+</echo>

        <hibernatedoclet
            destdir="${samples.gen-src.dir}"
            mergedir="${samples.src.dir}"
            excludedtags="@version,@author,@todo,@see"
            addedtags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}"
            force="${samples.xdoclet.force}"
            verbose="false">

            <fileset dir="${samples.java.dir}">
                <include name="**/**/*.java"/>
            </fileset>

            <hibernate version="3.0"/>

        </hibernatedoclet>
    </target>

    <!-- =================================================================== -->
    <!-- Clean                                                               -->
    <!-- =================================================================== -->
    <target name="clean">
        <delete dir="${samples.dist.dir}"/>
    </target>

</project>
build-dist.properties 文gQ?br># These properties are only used when building the samples expanded from the distribution.

lib.dir = ${xdoclet.root.dir}/lib
dist.lib.dir = ${lib.dir}

samples.dir = ${xdoclet.root.dir}
samples.dist.dir = ${samples.dir}/target
samples.lib.dir = ${samples.dir}/lib
samples.src.dir = ${samples.dir}/src
samples.java.dir = ${samples.src.dir}/java
samples.gen-src.dir = ${samples.dist.dir}/gen-src

samples.meta-inf.dir = ${samples.dist.dir}/meta-inf
samples.web-inf.dir = ${samples.dist.dir}/web-inf
samples.merge.dir = ${samples.src.dir}/merge
samples.classes.dir = ${samples.dist.dir}/classes
samples.web.dir = ${samples.src.dir}/web
samples.xdoclet.force = false

工程目录l构Q?a >从XDoclet|站下蝲该包Q解压羃后,把Example目录单独copy出来Q把q?个文件放在Example目录下,同时建立lib目录Q把XDoclet目录?-〉lib目录下的*.jar拯到Example新徏立的lib目录下?/font>


]]>
վ֩ģ壺 ԭ| | ְ| SHOW| ɽ| | | DZ| ƽ| ˮ| | | | | | ͡| | | | | ʯ| Ϫ| | ˶| Ϫ| ɽ| | | ̫| ϼ| | | ˮ| ͨ| | ͼ| | ٲ| ͼ| | |