??xml version="1.0" encoding="utf-8" standalone="yes"?>免费一级在线观看,午夜一区在线,国产精品久久久久毛片软件http://www.aygfsteel.com/koradji/category/38083.htmlzh-cnThu, 26 May 2011 21:02:17 GMTThu, 26 May 2011 21:02:17 GMT60RMI中的对象传?/title><link>http://www.aygfsteel.com/koradji/articles/351135.html</link><dc:creator>koradji</dc:creator><author>koradji</author><pubDate>Thu, 26 May 2011 15:51:00 GMT</pubDate><guid>http://www.aygfsteel.com/koradji/articles/351135.html</guid><wfw:comment>http://www.aygfsteel.com/koradji/comments/351135.html</wfw:comment><comments>http://www.aygfsteel.com/koradji/articles/351135.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/koradji/comments/commentRss/351135.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/koradji/services/trackbacks/351135.html</trackback:ping><description><![CDATA[对于RMI的远E接口方法来_(d)传入参数或返回值可以是McdQ包括本地对象,q程对象以及(qing)原始数据cd。更准确地说QQ何类型的M实体Q可理解为类和对象的关系Q都能被传入或传E方法,只要该实体是以下cd的实例:(x)原始数据cdQ远E对象,或者可串行化对象,卛_C接口java.io.Serializable?br />但是有些对象cd却不满以上q些要求Q因而不能被传入或传出。比如,U程或者文件描q符Q还有inputstreamQoutputstream对象Q,因ؓ(f)装了仅仅存在于单一地址I间的信息,q样便无法通过RMI传递。另外许多核心类Q包括位于java.lang和java.util包下的类都是实现了Serializable接口的?br />怎样传递参数和q回值的规则Q介l如下:(x)<br />1.q程对象是引用传递?br />q个引用是位于client端的stubQv着代理的作用,q程对象实现了的q程接口Q作Z理的stub也全部实玎ͼ<br />2.本地对象是g递,x贝?br />~省的话Q所有的属性都?x)被拯Q除了标CZؓ(f)static或transient的属性之外。这U缺省行为是可以在类里被覆盖的?br />q程对象的引用传递意味着对远E方法调用的对象的状态所作的M改变都将反映到该stub所对应的远E对象上厅R当一个远E对象被传递时Q接受者只能看到远E接口里定义的方法,而不能看到远E对象里定义的本地方法?br />本地对象的g递意味着MҎ(gu)受者的对象的状态的改变都不?x)媄响到发送者那里的对象Q反之亦然?img src ="http://www.aygfsteel.com/koradji/aggbug/351135.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/koradji/" target="_blank">koradji</a> 2011-05-26 23:51 <a href="http://www.aygfsteel.com/koradji/articles/351135.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>构徏一个简单的RMI应用E序http://www.aygfsteel.com/koradji/articles/344785.htmlkoradjikoradjiMon, 21 Feb 2011 15:30:00 GMThttp://www.aygfsteel.com/koradji/articles/344785.htmlhttp://www.aygfsteel.com/koradji/comments/344785.htmlhttp://www.aygfsteel.com/koradji/articles/344785.html#Feedback0http://www.aygfsteel.com/koradji/comments/commentRss/344785.htmlhttp://www.aygfsteel.com/koradji/services/trackbacks/344785.html     定义接口extends RemoteQ?br />     定义接口Ҏ(gu)Q注意需要throws RemoteExceptionQ?br />
W二步,实现remote接口Q?br />     实现接口里定义的各个Ҏ(gu)Q?br />     (optional)定义本地Ҏ(gu)Q即未在接口里定义的Ҏ(gu)Qclient端看不到Q?br />     定义static mainҎ(gu)Q这里需要实C列几步:(x)
        System.setSecurityManager(new RMISecurityManager()); //创徏q安装安全管理器
        取得args[0]参数Q实例化remotecobjQ?br />         Naming.rebind(args[0], obj); //l定名字和对?br />
W三步,创徏客户端类Q?br />     主要是定义static mainҎ(gu)Q这里需要实C列几步:(x)
        取得args[0]指定的server名字Q?br />         用Naming.lookup(server名字)查找l定的对象objQ?br />         调用obj的各个方法,像本地调用一P

W四步,创徏policy文gQ例如,创徏rmi.policy文gQ?br />     grant {
        // Allow everything for now
        permission java.security.AllPermission;
    };
    注意Q以上仅是用作练?fn)?br />
W五步,启动rmiregistryQ?br />     在dosH口下,输入Qstart rmiregistry(回R)
    ?x)弹出新H口Q表C正在运行rmiregistryQ?br />     注意Q一定要在remotecL在的目录下执行该命o(h)?/span>

W六步,启动server端程序:(x)
    输入命o(h)Qjava server?-Djava.security.policy="policy完整路径?

W七步,启动client端程序:(x)
    输入命o(h)Qjava server?br />
现在可以看到client-server间的通讯了?br />
补充Q实际测试发玎ͼ用一个helper对象装所有需要传lremotecȝҎ(gu)参数Q比起一个个参数传递性能要好很多?br /> helper对象一定要implements Serializable接口?/span>




koradji 2011-02-21 23:30 发表评论
]]>
java命o(h)行报错:(x)NoClassDefFoundError的解?/title><link>http://www.aygfsteel.com/koradji/articles/343371.html</link><dc:creator>koradji</dc:creator><author>koradji</author><pubDate>Sat, 22 Jan 2011 04:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/koradji/articles/343371.html</guid><wfw:comment>http://www.aygfsteel.com/koradji/comments/343371.html</wfw:comment><comments>http://www.aygfsteel.com/koradji/articles/343371.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/koradji/comments/commentRss/343371.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/koradji/services/trackbacks/343371.html</trackback:ping><description><![CDATA[一直在eclipse下开发java应用Q对java命o(h)行的使用很是生疏。今天,在命令行H口~译单的java文g旉到麻烦,化了不少旉才解冟?br /> 1.一个java文g里会(x)引用另一个java文gQ两个文件在同一个目录下Q但是却L报告说符号变量找不到?br /> 后来Q在命o(h)行中使用Q?span style="color: #0010ff;">javac -sourcepath 指定另一个文件的路径 java文g</span><br /> 问题解决了?br /> <br /> 2.接着在执行javaE序时又报错QNoClassDefFoundErrorQ可是明明两个class文g都在Q这是ؓ(f)什么呢Q?br /> 后来Q查了google才明白,原来是classpath里一定要在\径上加上“<span style="color: #0010ff;"><span style="color: #0010ff;"><span style="color: #0010ff;">.</span>;</span></span>”Q漏掉这个小的点就?x)报q种错误?br /> <br /> 环境问题Q\径问题这些L让java开发者抓?)<br /> <br /> <img src ="http://www.aygfsteel.com/koradji/aggbug/343371.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/koradji/" target="_blank">koradji</a> 2011-01-22 12:40 <a href="http://www.aygfsteel.com/koradji/articles/343371.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>struts2中有兛_际化的应?/title><link>http://www.aygfsteel.com/koradji/articles/307755.html</link><dc:creator>koradji</dc:creator><author>koradji</author><pubDate>Wed, 30 Dec 2009 07:17:00 GMT</pubDate><guid>http://www.aygfsteel.com/koradji/articles/307755.html</guid><wfw:comment>http://www.aygfsteel.com/koradji/comments/307755.html</wfw:comment><comments>http://www.aygfsteel.com/koradji/articles/307755.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/koradji/comments/commentRss/307755.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/koradji/services/trackbacks/307755.html</trackback:ping><description><![CDATA[<strong><u>资源文g的定义:(x)<br /> </u></strong>在struts2里,资源文g被分成了三个U别Q类U别Q包U别Q全局U别?br /> 执行Ӟ按照从到大的序依次搜烦资源文g里的key|直至扑ֈ?br /> cȝ别的文g名定义:(x)Actioncd_语言码_国家?propertiesQ比如:(x)LoginAction_en_US.propertiesQLoginAction_zh_CN.propertiesQ?br /> 如果是在全局中定义资源文Ӟ则需要在struts.xml里配|,例子Q?lt;constant name="struts.custom.i18n.resources" value="message" />Q其中message源文件的起始名;<br /> 全局资源文g的位|在src\下?br /> <br /> <strong><u>如何写中文的资源文gQ?br /> </u></strong>对于用于中文昄的资源文Ӟ以前需要用java自带的native2ascii.exe中文内容{换成对应的unicodeQ比较麻烦,而现在可以用eclipse的插件自动{换?br /> eclipse插gQ?span style="background-color: yellow">propertieEdit</span>(一Ƅ日本人开发的开源插Ӟ可直接输入中文,自动转换)<br /> 本地下蝲linkQ?a href="/Files/koradji/propertieEdit.zip">/Files/koradji/propertieEdit.zip</a><br /> 下蝲后,里面的目录拯到eclipse下对应的目录里,重新启动eclipse可以了?可能需要在启动命o(h)里加?clean)?br /> <br /> <strong><u>在jsp里读取资源文件的Ҏ(gu)Q?/u></strong><br /> 画面上的文字采用<s:text name="key" />写;<br /> 其他的,比如按钮的valueQtextfield的label{采?lt;%{getText('key')}>写,例子Q?lt;s:submit action="confirm" value="%{getText('confirm.button.label')}" /> Q?br /> 或者,也可以用这L(fng)写法Q?lt;s:textfield name="username" <span style="background-color: yellow">key</span>="page.index.text.username"></s:textfield><br /> 使用<s:i18n>可以指定临时的资源文Ӟ<br /> 例子1Q?br />     <s:i18n name="temp">  ----- baseName对应名称的资源文件名<br />      <s:text name="info">  ----- info源文件中的key<br />       <s:param>张三</s:param>  ---- 指定W一个参?nbsp; {0}<br />       <s:param>23</s:param>     ---- 指定W二个参?nbsp; {1}<br />      </s:text><br />     </s:i18n><br /> 例子2Q?br />     <s:i18n name="org.scorpio.jh.struts2.i18n.web.action.LoginAction"><br />      <s:text name="page.index.text.username"></s:text><br />      <s:text name="page.index.text.password"></s:text><br />     </s:i18n><br /> 没有实际应用q,猜测可能是在面上指定某个区域可以显CZdefault locale不同的语a文字Q?br /> <br /> <strong><u>在java里读取资源文件的Ҏ(gu)Q?/u></strong><br /> Actionc里(需要承ActionSupport)Q用getText(String key)Ҏ(gu)p取得资源文g里的|<br /> Business Servicesc里Q用ResourceBundle.getBundle(资源文g?.getString(key)Ҏ(gu)取得|<br /> <br /> <strong><u>如何切换画面语言Q?/u></strong><br /> 在jsp里,在适当的位|放入下面的代码Q?br /> <s:url id="url" action="UnsubscribeNL_language"><br />      <s:param name="<span style="background-color: yellow">request_locale</span>">en_US</s:param><br /> </s:url><br /> <s:a href="%{url}">English</s:a><br><br /> <s:url id="url" action="UnsubscribeNL_language"><br />      <s:param name="<span style="background-color: yellow">request_locale</span>">zh_CN</s:param><br /> </s:url><br /> <s:a href="%{url}">体中?lt;/s:a><br /> 在发送请求时Qstruts?x)搜索拦截request_locale变量Qƈ该变量D为default localeQ?br /> 在Actionc里加入一个方法:(x)public String language()Q运行初始化q回本画面即可;<br /> <img src ="http://www.aygfsteel.com/koradji/aggbug/307755.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/koradji/" target="_blank">koradji</a> 2009-12-30 15:17 <a href="http://www.aygfsteel.com/koradji/articles/307755.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>struts2的s:checkboxlist标签学习(fn)http://www.aygfsteel.com/koradji/articles/307399.htmlkoradjikoradjiSat, 26 Dec 2009 16:16:00 GMThttp://www.aygfsteel.com/koradji/articles/307399.htmlhttp://www.aygfsteel.com/koradji/comments/307399.htmlhttp://www.aygfsteel.com/koradji/articles/307399.html#Feedback0http://www.aygfsteel.com/koradji/comments/commentRss/307399.htmlhttp://www.aygfsteel.com/koradji/services/trackbacks/307399.html s:checkboxlist用于画面上显CZl复选框Q缺省是横排输出Q后面将介绍如何修改ftl文g使得它能按Q意方式输出?br /> 标签格式Q?/u>
    <s:checkboxlist name="" list="" listKey="" listValue="" value="" />
    name-定义标签名,用于接收画面上选中的复选框Q故应与Action里定义的属性一_(d)且多为数l;
    list-定义集合变量Q用于输出复选框到画面上Q一般在Action里定义一个List或Map属性;
    listKey-如果在Action里定义的是一个ListQ则往往?x)在List里定义一个BeanQ它只有两个属性,其中一?比如id)在q里讄Q?br />                 如果在Action里定义的是一个MapQ则Map的key在q里讄Q?br />     listValue-如果在Action里定义的是一个ListQ则往往?x)在List里定义一个BeanQ它只有两个属性,另外一?比如name)在q里讄Q?br />                   如果在Action里定义的是一个MapQ则Map的value在q里讄Q?br />     value-用于回显画面上被选中的复选框Q假如画面有输入查,如果有错则返回原画面q显C出错信息,q时候就需要用它?br />              一般把它设成和name一致就可以了?br /> 注意点:(x)
    Z能正显C已被选中的复选框Q一定要使得name的数l类型与listKey的类型一致?br />     比如Qname设成String[] usersQ则listKeyp设成String idQ如果name设成Integer[] usersQ则listKeyp设成Integer idQ?br /> 修改ftl文g改变输出方式Q?/u>
    1.搜烦struts2-core-xxx.jarQ找到checkboxlist.ftl文gQ拷贝出来;
    2.在自q工程的src下新建template.simple包,攄上述文gQ?br />     3.用文本编辑器打开该文Ӟ修改成自己希望输出的格式Q保存,OKQ?br /> 例子Q?/u>
    希望画面上每3个复选框输出Z行?/span>
<#--
/*
 * $Id: checkboxlist.ftl 804072 2009-08-14 03:16:35Z musachy $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
-->
<#assign itemCount = 0/>
<#if parameters.list?exists>
     <@s.iterator value="parameters.list">
         <#assign itemCount = itemCount + 1/>
         <#if parameters.listKey?exists>
             <#assign itemKey = stack.findValue(parameters.listKey)/>
         <#else>
             <#assign itemKey = stack.findValue('top')/>
         </#if>
         <#if parameters.listValue?exists>
             <#assign itemValue = stack.findString(parameters.listValue)/>
         <#else>
             <#assign itemValue = stack.findString('top')/>
         </#if>
 <#assign itemKeyStr=itemKey.toString() />
 <#if (itemCount-1)%3 == 0>
 <tr>
 </#if>
 <td>

 <input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
         <#if tag.contains(parameters.nameValue, itemKey)>
  checked="checked"<#rt/>
         </#if>
         <#if parameters.disabled?default(false)>
  disabled="disabled"<#rt/>
         </#if>
         <#if parameters.title?exists>
  title="${parameters.title?html}"<#rt/>
         </#if>
         <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
         <#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
 />
 <label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label>
 </td>
 <#if itemCount%3 == 0>
 </tr>

 </#if>
     </@s.iterator>
</#if>
<input type="hidden" id="__multiselect_${parameters.id?html}" name="__multiselect_${parameters.name?html}" value=""<#rt/>
<#if parameters.disabled?default(false)>
 disabled="disabled"<#rt/>
</#if>
 />





koradji 2009-12-27 00:16 发表评论
]]>
zip filehttp://www.aygfsteel.com/koradji/articles/257853.htmlkoradjikoradjiWed, 04 Mar 2009 10:48:00 GMThttp://www.aygfsteel.com/koradji/articles/257853.htmlhttp://www.aygfsteel.com/koradji/comments/257853.htmlhttp://www.aygfsteel.com/koradji/articles/257853.html#Feedback0http://www.aygfsteel.com/koradji/comments/commentRss/257853.htmlhttp://www.aygfsteel.com/koradji/services/trackbacks/257853.html/*==============================================================================
 *ZIP嶌惉僣乕?br />  =============================================================================*/
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
 
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
 
public class ZipCompressor {
    static final int BUFFER = 8192;
 
    private File zipFile;  
 
    public ZipCompressor(String pathName) {
        zipFile = new File(pathName);  
    }  
 
    public void compress(String srcPathName) {  
        File file = new File(srcPathName);  
        if (!file.exists())  
            throw new RuntimeException(srcPathName + "懚匧(do)偟側?);  
        try {  
            FileOutputStream fileOutputStream = new FileOutputStream(zipFile);  
            CheckedOutputStream cos = new CheckedOutputStream(fileOutputStream,  
                    new CRC32());  
            ZipOutputStream out = new ZipOutputStream(cos);  
            String basedir = "";  
            compress(file, out, basedir);  
            out.close();  
        } catch (Exception e) {  
            throw new RuntimeException(e);  
        }  
    }  
 
    private void compress(File file, ZipOutputStream out, String basedir) {  
        /* 僨傿儗僋僩儕偲偐僼傽僀儖偲偐偦傟偧傟張偟傑偡 */ 
        if (file.isDirectory()) {  
            System.out.println("埑弅? + basedir + file.getName());  
            this.compressDirectory(file, out, basedir);  
        } else {  
            System.out.println("埑弅? + basedir + file.getName());  
            this.compressFile(file, out, basedir);  
        }  
    }  
 
    /** 僨傿儗僋僩儕傪埑?*/ 
    private void compressDirectory(File dir, ZipOutputStream out, String basedir) {  
        if (!dir.exists())  
            return;  
 
        File[] files = dir.listFiles();  
        for (int i = 0; i < files.length; i++) {  
            compress(files[i], out, basedir + dir.getName() + "/");  
        }  
    }  
 
    /** 暥審傪埑?*/ 
    private void compressFile(File file, ZipOutputStream out, String basedir) {  
        if (!file.exists()) {  
            return;  
        }  
        try {  
            BufferedInputStream bis = new BufferedInputStream(  
                    new FileInputStream(file));  
            ZipEntry entry = new ZipEntry(basedir + file.getName());  
            out.putNextEntry(entry);  
            int count;  
            byte data[] = new byte[BUFFER];  
            while ((count = bis.read(data, 0, BUFFER)) != -1) {  
                out.write(data, 0, count);  
            }  
            bis.close();  
        } catch (Exception e) {  
            throw new RuntimeException(e);  
        }  
    }  

 



koradji 2009-03-04 18:48 发表评论
]]>
վ֩ģ壺 | | Զ| ܱ| | Ƽ| ɽ| | Ƹ| ˳| ӻ| | | ˿| | Զ| Ӫ| | Ӵ| | | | | | | Զ| ֦| | | Ļ| | | ʡ| | | ߷| ʯ¥| ˮ| ݳ| | |