Struts下配置log4j的方法(转帖2篇)

第一篇:转自:http://tech.eyeah.cn/3116/1113/1137/234119733.html

Log4J配置完后,tomcat5启动如此报错。

 作 者:程序员(onebelief)

 时 间:2005-02-26 12:30:08

 

log4j:WARN No appenders could be found for logge(org.apache.catalina.session.ManagerBase).

log4j:WARN Please initialize the log4j system properly.

讨教,讨教。

回复人:程序员(onebelief)2005-2-26 13:06:52

没有人知道么!?

回复人: throw new LowSalaryException(me) (kaymo)2005-2-26 14:08:36

一个包,2个配置文件

回复人:程序员(onebelief)2005-2-26 14:14:48

能说详细点儿么!?我是在架struts应用时出现的这个问题。

struts中的log4j怎么初始化!?

谢谢,请教完马上可以给分!

回复人:西门疯雪(bon_jovi)2005-2-26 14:30:51

log4j.jar和commons-logging.jar放到你的web应用底下的lib中。

在classes下建立两个配置文件commons-logging.properties和log4j.properties

commons-logging.properties里就一行,org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog说明用的是log4j。

启动tomcat就可以了。

你的类里面写日志都是调用的apache的接口,以后换其他日志系统也方便。

回复人:程序员(onebelief)2005-2-26 14:33:18

非常感谢

第二篇:转自:http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=121&threadID=4267&tstart=450

回复: 5   页数: 1   

gyokuho [普通用户]

发帖数: 9

活跃积分: 11

技术积分: 0

可用币值: 11

注册时间: 2002-9-4

用户状态:正常

 

 请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Jun 9, 2003 2:04:03 AM         引用  回复    发消息 

 

我用 Weblogic 7.0, Struts 1.1, commons-logging.properties 中只有一句:

    org.apache.commons.logging.Log=

        org.apache.commons.logging.impl.Log4JLog 

这样,输出到确省的 System.err去了。怎样配置才能指定输出到一个log文件?

查资料后,好像有:

  1, -Dlog4j.configuration=Log4JLog.properties

  2, 然后在 Log4JLog.properties 中写一些key=value。

什么的,在我的环境中试验后没有成功。请问具体需要怎样做才解决问题?

此文被gyokuho在2003/06/09 16:14:48修改!

--------------------------------------------------------------------------------

 

 

bea_ora [普通用户]

发帖数: 222

活跃积分: 225

技术积分: 3

可用币值: 240

注册时间: 2003-3-26

用户状态:正常

 

 Re:请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Jun 10, 2003 4:26:47 AM         引用  回复    发消息 

 

log4j里面有一个

log4j.appender.R=org.apache.log4j.RollingFileAppender

log4j.appender.R.File=example.log

log4j.appender.R.MaxFileSize=100KB

可以把log写到里面,具体的

你查一下log4j API 和

http://www.jfsys.com/main/service/service_log4j.htm

资料吧

此文被bea_ora在2003/06/09 20:31:02修改!

--------------------------------------------------------------------------------

 

 

gyokuho [普通用户]

发帖数: 9

活跃积分: 11

技术积分: 0

可用币值: 11

注册时间: 2002-9-4

用户状态:正常

 

 Re:请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Jun 11, 2003 4:30:25 AM         引用  回复    发消息 

 

多谢回复。

我在Log4j 的主页上也看到了这样的例子,但是自己试了几次,没有成功。

我不知道那些个设置应该放在哪个properties文件中,这个properties 文件

又应该放在什么位置。

希望做成功的同志给与指导。

--------------------------------------------------------------------------------

 

 

xutong [普通用户]

发帖数: 16

活跃积分: 15

技术积分: 1

可用币值: 10

注册时间: 2004-6-11

用户状态:正常

 

 Re: 请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Oct 25, 2005 4:01:05 PM         引用  回复    发消息 

 

../WEB-INF/class

--------------------------------------------------------------------------------

 

 

fengw [普通用户]

发帖数: 692

活跃积分: 695

技术积分: 60

可用币值: 590

注册时间: 2003-7-18

用户状态:正常

 

 Re: 请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Oct 25, 2005 4:47:14 PM         引用  回复    发消息 

 

需要在类路径下添加 log4j.properties文件。

下面是文件的内容,这个我就简单写了点,需要扩展的话查文档

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.Target=System.out

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=debug,stdout

log4j.logger.com=warn,stdout

--------------------------------------------------------------------------------

让开,让开~~~~~~~

            ╭══╮

          ╭╯ΘΘ║

          ╰⊙═⊙╯。oо○-俺的灌水车来了!!

 

 

ttoc [普通用户]

发帖数: 58

活跃积分: 57

技术积分: 0

可用币值: 57

注册时间: 2005-8-27

用户状态:正常

 

 Re: 请教:Weblogic/Struts/Log4J 环境下,log destination(appender) 配置问题

提交时间: Oct 25, 2005 4:55:36 PM         引用  回复    发消息 

 

log4j.rootLogger=INFO,stdout,file

log4j.logger.com.common.utility.MailSend=ERROR,A1

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender

log4j.appender.file.File=c:/aaa.txt

log4j.appender.file.layout=org.apache.log4j.PatternLayout

log4j.appender.file.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n

log4j.appender.rolling.layout=org.apache.log4j.PatternLayout

log4j.appender.rolling.layout.ConversionPattern=%d %r [%t] %5p [%F:%L] - %m%n

log4j.appender.rolling=org.apache.log4j.RollingFileAppender

log4j.appender.rolling.File=c:\comics.log

#log4j.appender.rolling.File=/usr/local/tomcat/logs/comics.log

log4j.appender.rolling.MaxFileSize=5120KB

log4j.appender.rolling.MaxBackupIndex=10

log4j.appender.A1=org.apache.log4j.RollingFileAppender

log4j.appender.A1.File=c:\mail.log

#log4j.appender.A1.File=/usr/local/tomcat/logs/comics.log

log4j.appender.A1.MaxFileSize=500KB

log4j.appender.A1.MaxBackupIndex=50

log4j.appender.A1.Append=true

log4j.appender.A1.layout=org.apache.log4j.PatternLayout

log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} - [%p] [%C{1}] - %m%n

 

 

(转)[提问] 这样的需求测试用例该怎么设计?(junit答案)

转自:http://www.cntesting.com/bbs/read.php?tid=623&fpage=1

[提问] 这样的需求测试用例该怎么设计?

心力背单词 [traffic /'træfik/ n. 交通(量) ]

到某论坛上逛了一圈,看到了这个提问正好是我的本行,所以特别拿出来秀以下,如果这个朋友到了我们这里可以直接问我。

原贴:

本地写卡功能:

界面:

号码、产品、副号、空SIM卡

号码和空卡为可输入框

1、号码不能是一卡双号的副号,可以是:全球通普通号码,全球通一卡双号主号(若有副号,直接把副号赋给副号输入框处)、神州行、动感地带

2、号码状态必须是正使用状态

3、SIM卡状态是可用状态

4、动感地带号码只能用“28动感地带空白SIM卡”,神州行只能用“29 神州行空白SIM卡”,全球通用“26全球通空白SIM卡”和“27 一卡双号空白SIM卡”;如果输入该号码有副号则只允许写“27 一卡双号空白SIM卡”;

符合1、2、3、4 写卡成功

若号码状态不对, 提示请用正使用的号码

若卡状态不对,提示请用可用状态的卡

若不符合1,提示副号不能写卡

若不符合4,提示卡类型不正确

 

 

测试是非常古老的传统行业,据说地球起源来自于一场非常糟糕的实验。根据我最新考证,上帝创造的亚当夏娃就没有经过很好的测试,不然怎么会因为一个APPLE_BUG就导致了整个世界的崩溃?! 

[楼 主] | Posted:2005-11-03 22:53|  

 

 

smile_xunn

 

 

级别: 测试新手

精华: 0

发帖: 2

测试威望: 2 点

测试币: 6 CSB

测试贡献值: 0 点

在线时间:5(小时)

注册时间:2005-11-08

最后登陆:2005-12-12       

--------------------------------------------------------------------------------

心力背单词 [sail /seil/ n. 帆,航行;vi. 航行,启航,翱游,飘;vt. 航行,飘过 ]

准备一些定义,如下:

全球通普通号码 commonCode

全球通一卡双号主号 doubleCode

神州行 allGo

动感地带 dyArea

号码状态 codeState

SIM卡状态 simState

28动感地带空白SIM卡 dyArea28

29 神州行空白SIM卡 allGo29

26 全球通空白SIM卡 doubleCode26

27 一卡双号空白SIM卡(无副号) doubleCode27

27 一卡双号空白SIM卡(有副号) doubleCode27Fu

测试java伪代码如下:

/**

* 定义一个Product Bean,由它来定义卡的类型,如下:

* 28动感地带空白SIM卡 dyArea28

* 29 神州行空白SIM卡 allGo29

* 26 全球通空白SIM卡 doubleCode26

* 27 一卡双号空白SIM卡(无副号) doubleCode27

* 27 一卡双号空白SIM卡(有副号) doubleCode27Fu

*/

public class Product{

  private String _productId = "commonCode";//产品编码,默认为全球通编码

  private String _productName = "全球通普通号码";//产品名称,默认为全球通描述

  public Product(String productId,String productName){

        this._productId = productId;

        this._productName = productName;

  }

  public Product(){

  }

 

}

/**

* 定义一个Card JavaBean.

*/

public class Card{

  private String _startCode = null;//号码

  private Product _product = null;//产品

  private String _endCode = null;//副号

  private boolean _isState = false;//卡状态

  public Card(String startCode ,Product product,String endCode,boolean isState ){

      this._startCode = startCode;

      this._product = product;

      this._endCode = endCode;

      this._isState = isState;

  }

  public void setStartCode(String startCode){

      this._startCode = startCode;

  }

  public String getStartCode(){

      return _startCode ;

  }

 

  public void setEndCode(String endCode){

      this._endCode = endCode;

  }

  public String getEndCode(){

      return _endCode;

  }

  public void setProduct(Product product){

    this. _product = product;

  }

  public Product getProduct(){

    return _product;

  }

  public void setIsState(boolean isState){

    this._isState = isState;

  }

  public boolean getIsState(){

    return _isState;

  }

  /* *

  * 对_startCode,_endCode进行代码检查,

  */

  public boolean isRightCode(){

    return false;//没有作代码实现,返回值为false;

  }

  /**

  * 得到代码范围,通过判断主号和辅号,判断该号码属于哪种卡,如“28动感地带    

  * 空白SIM卡”

  */

  pubic String getCodeType(){

    //未作实现代码返回值为空

    return null;

  }

}

/**

* 使用继承junit TestCase 的 CardTest类进行测试

*/

public Class CardTest extends TestCase{

  public void testWriteCard(Card card){

    //如果号码状态不对,提示请用正使用的号码

    assertTrue(card.getIsState(),"请用正使用的号码");

    //若卡状态不对,提示请用可用状态的卡

    assertTrue(card.isRightCode(),"请用可用状态的卡");

    // 如果输入该号码有副号则只允许写“27 一卡双号空白SIM卡”;

    if(card.getEndCode()!=null &&!card.getEndCode().trim().equals("")){

    card.getCodeType().equals("27 一卡双号空白SIM卡");

    }

    //1、号码不能是一卡双号的副号,可以是:全球通普通号码,全球通一卡双号主号     //(若有副号,直接把副号赋给副号输入框处)、神州行、动感地带

    String productName = card.getProduct().getProductName().;

   

    if(productName .equals("全球通普通号码")){

        //全球通用“26全球通空白SIM卡”和“27 一卡双号空白SIM卡”        

      if(!(card.getCodeType().equals("26全球通空白SIM卡")||

        card.getCodeType().equals("27 一卡双号空白SIM卡"))){

            assetFalse(true,"卡类型不正确");

      }

    } else if(productName.equals("全球通一卡双号主号")){

        //ok;

    }else if(prodcutName.equals("神州行")){

        //神州行只能用“29 神州行空SIM卡”          

        if(!card.getCodeType().equals("29 神州行空白SIM卡")){

            assetFalse(true,"卡类型不正确");

        }

    }else if(prodcutName.equals("动感地带")){

        //动感地带号码只能用“28动感地带空白SIM卡”

      if(!card.getCodeType().equals("28动感地带空白SIM卡")){

            assetFalse(true,"卡类型不正确");

      }

             

    }else{

        assertTrue(false,"副号不能写卡");

    }

    asserTrue(true,"写卡成功");

   

}

 

 

[转帖] 利用StrutsTestCase测试Struts应用程序

转自:http://www.cntesting.com/bbs/read.php?tid=1239

--------------------------------------------------------------------------------

[转帖] 利用StrutsTestCase测试Struts应用程序

心力背单词 [partly /'pa:tli/ ad. 部分地,在一定程度上 ]

作者:叶枫(http://blog.matrix.org.cn/page/叶枫)

关键字:Struts StrutsTestCase

一、Struts测试概述

 

  一个具有良好系统架构的J2EE应用程序至少有三层组成,即表现层,商业层和系统

集成层(包括数据存取以及和其他系统集成),目前,Struts是应用比较广泛,实现MVC2模式应用于表现层的一种技术. 在这里面,Struts Action主要用来完成一些简单的数据校验,转换,以及流程转发控制(注意:这里流程不是业务规则). 因此在对整个应用程序进行测试时,我们同时也要测试Struts Action.

  但是,测试Struts Action相对测试简单的JavaBean是比较困难,因为Struts是运行在Web服务器中, 因此要测试Struts Action就必须发布应用程序然后才能测试. 我们想象一下,对于一个拥有上千个JSP page和数百甚至数千Java Classes的大规模应用程序,要把他们发布到诸如Weblogic之类的应用服务器再测试,需要多少的时间和硬件资源? 所以这种模式的测试是非常费时费力的.

  所以,如果有一种办法能够不用发布应用程序,不需要Web服务器就能象测试普通Java Class一样测试Struts Action,那就能极大地加强Struts的可测试性能,使应用程序测试更为容易,简单快速. 现在这个工具来了,这就是StrutsTestCase.

二、StrutsTestCase 概述

  StrutsTestCase 是一个功能强大且容易使用的Struts Action开源测试工具,

它本身就是在大名鼎鼎的JUnit基础上发展起来的。因此通过和JUnit结合

使用能极大加强应用程序的测试并加快应用程序的开发.

 

  StrutsTestCase提供了两者测试方式,模仿方式和容器测试方式. 所谓模仿方式就是有StrutsTestCase本身来模拟Web服务器. 而容器测试方式则需要Web服务器. 本文要讨论的是前者,原因很简单,不需要Web服务器就能象测试普通的Java Class一样测试Struts Action.

三、准备StrutsTestCase和Struts Action/ActionForm/Config

  StrutsTestCase是一个开源工具,可以到http://strutstestcase.sourceforge.net下载. 目前最新版本是2.1.3,

如果你使用Servlet2.3就下载StrutsTestCase213-2.3.jar,使用Servlet2.4的就下载StrutsTestCase213-2.4.jar.

另外StrutsTestCase本身就是从JUnit继承的,所以你还需要下载JUnit3.8.1.

  在本文中,我们用一个简单的例子来做测试. 假设我们有一张表Hotline(country varchar2(50),pno varchar2(50)),

我们要做的是根据输入条件从这张表检索相应的记录.检索条件是country.

Value Object: 

package sample;            public class HotlineDTO implements Serializable{        private String country = "";       private String pno = "";                /**         * Method HotlineActionForm         *         *         */        public HotlineDTO () {             super();      }                public void setCountry(String country) {                this.country = country;         }        public void setPno(String pno) {                this.pno = pno;         }        public String getCountry() {                return (this.country);         }        public String getPno() {                return (this.pno);         }              }

ActionForm:

     

package sample;      import org.apache.struts.action.ActionForm;      public class HotlineActionForm extends ActionForm{        private String country = "";        private String pno = "";                /**         * Method HotlineActionForm         *         *         */        public HotlineActionForm() {                super();        }                public void setCountry(String country) {                this.country = country;         }        public void setPno(String pno) {                this.pno = pno;         }        public String getCountry() {                return (this.country);         }        public String getPno() {                return (this.pno);         }              } 

Action Class:

     public class SearchHotlineAction extends Action {     public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,      HttpServletResponse response) throws Exception {        String target = "";        try{         //调用HotlineDAO检索hotline         String country=((HotlineActionForm)form).getCountry();         List hotlineList = HotlineDAO.getHotlineList(country);         if(hotlineList!=null && hotlineList.size()>0){            request.setAttribute("hotlineList",hotlineList);            target = "hotlineList";         }else{            target = "notfound";         }        }catch(Exception ex){           ....        }                             }

Struts Config:

 

<struts-config>      <form-beans>     <form-bean name="hotlineActionForm" type="sample.HotlineActionForm" />       .......   </form-beans>  <action-mappings>     <action path="/SearchHotline"           name="hotlineActionForm"           type="sample.SearchHotlineAction "                     scope="request"                                                      validate="false">       <forward name="hotlineList" path="/hotlineList.jsp"/>              <forward name="notfound" path="/searchHotline.jsp"/>   </action>    .....  <action-mappings>   ........ <struts-config>

四、初试StrutsTestCase

    当采用模拟方式时,所有的StrutsTestCase测试Class都是从MockStrutsTestCase继承下来的.

    下面我们就创建一个最简单的测试Class.

   

public class SearchHotlineAction extends MockStrutsTestCase {     public void setUp()throws Exception{     }     public void tearDown()throws Exception{     }    public void testSearchHotline() throws Exception{    setRequestPathInfo("/SearchHotline.do");    addRequestParameter("country", "CN");    actionPerform();    }    }

   上面的Class相信用过JUnit的朋友都很熟悉.

    好了,一个简单的测试例子就完成了,如果你用的是Eclipse就选择Run-Run...-JUnit-New就可以直接运行.不需要发布你的程序,不需要任何的Web服务器支持,就可以测试Struts Action,这就是StrutsTestCase带来的好处.下面简单地介绍一下它是怎么工作的.

    在上面的例子中,我们调用setRequestPathInfo()告诉StrutsTestCase我们要模拟JSP调用SearchHotline.do这个Action,并且调用addRequestParameter()增加了一个参数country.最后调用actionPerform()运行.

看到这里,大家发现一个问题没有? 在上面Action的源代码里我们是通过

String country=((HotlineActionForm)form).getCountry();

也就是ActionForm来取得输入的参数值,可我们在testSearchHotline()方法里并没有设置ActionForm?

那么它是怎么出来的呢? 其实大家如果熟悉Struts的运行流程的话就知道,JSP接受用户的输入并发请求时

都是类似这样的http://hostname/servletName?param1=value1¶m2=value2. 只是Struts接受到这些

参数后再根据Struts Config里的Action和ActionForm的映射把他们转为ActionForm后传给Action的.

   在上面的例子,我们只是简单地运行了Action,那么Action是否正确执行以及返回的结果是不是我们想要的呢?

我们继续完善一下testSearchHotline()这个Method.

public void testSearchHotline() throws Exception{

    setRequestPathInfo("/SearchHotline.do");

    addRequestParameter("country", "CN");

    actionPerform();

    verifyNoActionErrors();

    verifyForward("hotlineList");

    assertNotNull(request.getAttribute("hotlineList"));

    List hotlineList = (List) request.getAttribute("hotlineList");

    for (Iterator it = hotlineList.iterator();it.hasNext();){

     ....

    }

    }

我们在actionPerform()后增加了几行语句来断定Struts Action是否正确执行.

   verifyNoActionErrors() -- 判断Action里没有任何的Action;

   verifyForward("hotlineList") -- 判断Action确实转发到hotlineList;     

   assertNotNull(request.getAttribute("hotlineList")) -- 判断Action确实返回了hotlineList并且不为空

到这里,我们已经基本上讨论完了StrutsTestCase的核心部分. 从头到尾,我们没有发布应用程序,也不需要Web服务器,对我们来讲,Struts Action就象普通的Java Class一样容易调试测试.这就是StrutsTestCase给我们带来的方便.

五、深入StrutsTestCase

  除了以上我们用到的几个断定和校验方法外,StrutsTestCase还提供了其他几个方法便于我们测试Struts Action. 下面我一一讲述,具体的大家可以参考文档.

verifyActionErrors/Messages --  校验ActionActionServlet controller 是否发送了ActionError或ActionMessage.   参数为ActionError/Message Key

verifyNoActionErrors/Messages --校验ActionActionServlet controller 没有发送ActionError或ActionMessage

VerifyForward -- 校验Action是否正确转发到指定的ActionForward.

VerifyForwardPath -- 校验Action是否正确转发到指定的URL

verifyInputForward -- 校验Action是否转发到Action Mapping里的input属性

verifyTilesForward/verifyInputTilesForward--和以上类似,应用程序使用到tiles时用的

六、关于Web.xml和Struts-Config.xml

  缺省情况下,StrutsTestCase认为你的Web.xml和struts-config.xml的路径分别是:

  /WEB-INF/web.xml和/WEB-INF/struts-config.xml

  1. 假如你的web.xml/struts-config.xml的路径是

  d:/app/web/WEB-INF/web.xml(struts-config.xml)的话,就需要把d:/app/web加到classpath.

 

  2. 假如你的struts config是strust-config-module.xml,

  那么必须调用setConfigFile()设置你的struts config文件

 

七、结束语

  J2EE应用程序的测试在开发过程中占有相当重要的位置,利用StrutsTestCase能极大方便你测试基于Struts的应用程序.

关于作者:

叶枫:热爱Java和Oracle. 在软件开发有近10年, 目前在国外一家美国大公司担任SA, 负责技术研究。

(转帖)webwork并入struts团队了!

对学习Struts的朋友是一个利好的消息,正文如下:

webwork并入struts团队了!

来源:http://www.javaeye.com/viewtopic.php?t=17242&postdays=0&postorder=asc&start   发表时间:2005-11-29 09:29 

 

WebWork joining Struts

Yes, it's true. The WebWork development team (Jason and I) have been working with the Struts development team (Don Brown and Ted Husted) and have come to the conclusion that the best thing for Java community would be to merge WebWork in to Struts.

Read Ted's email here, but the gist of it is this: WebWork is a great technology, and Struts is a great community. It's a perfect match and bringing the two together will only be better for WebWork and Struts users alike. The only down side for me is that I'll be working less with OpenSymphony, but I believe that is a small price for all the great benefits that come from this merger.

Just to be clear, WebWork is not going away. WebWork 2.2 is still coming out any day now, and there may even be a WebWork 2.3. But new minor/major versions won't be coming out under the WebWork name for much longer. Instead, they will be released under the Struts incubator program with the intent to eventually become Struts Action Framework 2.0.

So don't worry, WebWork 2.1.8, 2.2.1, and other bug fix releases will continue to come out and we will support the WebWork community as long as needed. In addition, we'll make compatibility with both Struts and WebWork a high priority, so future releases may help with that. To be clear: no one is leaving WebWork and it will continue to be supported for a very long time.

With this renewed energy, larger development team, and larger community, the combined efforts of Struts and WebWork will surely make the Struts platform the easiest, fastest, and most powerful Java web framework available. We hope that all the WebWork users and developers are as excited about this as we are and are ready to take WebWork to the next level

原文:http://www.opensymphony.com/webwork/

 

阅读:321次  〔lanxing〕 

版权声明 

 

评论人:lanxing    参与分: 6527  专家分: 181  发表时间: 2005-11-29 09:42     评论 

 

一下文字来自javaeye的管理员 robbin

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

看到了这个消息以后感觉非常吃惊,所以跟踪相关的link仔细阅读了一下相关的网页,看完以后我认为对于webwork和struts来说这都是一个重大利好的消息。从整个事件来看,并不是单纯的webwork开发团队合并struts团队这么简单,事实上struts1.3和webwork2.2仍然按照原定roadmap继续发展,而两个团队核心开发人员发起一个新的项目Struts Ti,它的readmap是:

引用:

* Ti phase 1 = WebWork 2.2 + Struts 1.x compatibility library and migration tools

* Ti phase 2 = phase 1 + Commons Chain integration + Beehive's Page Flow + simplified annotations + quick development mode

从这个roadmap可以看出来,新项目Struts Ti是以webwork的整体架构为基础,辅以Struts的一些库,并且该项目的四个发起人联名的声明中这样说:

引用:

As some of you know, the underlying idea behind Ti was to use WebWork as the core of Struts Action Framework 2.x. Conceptually, WebWork and Struts 1.x are very similar. We've often said, without embarrassment, that WebWork does many things better than Struts 1.x. Meanwhile, WebWork has the ability to provide a layer of almost full backwards-compatibility for Struts 1.x, and we have already demonstrated we can integrate Beehive's (very cool) Page Flow with WebWork.

这段话明白无误的指明新框架是以webwork为core的,并且webwork可以提供一个抽象层,以完全向后兼容Struts1.x,并且struts还可以集成Apache Beehive的Page Flow。

因此,我想那些担心webwork从此消失的人可以打消顾虑了,消失的只是webwork这个名字,和com.opensymphony的package前缀,而webwork的程序架构却不会消失。

对于Struts的使用者来说,Struts虽然拥有一个庞大的使用群体,但是Struts在技术上已经非常落伍,再不进行重大的架构革新,势必要被淘汰。因此,这个事情是Struts开发团队的一次自救的革命,从Struts1.3到Struts Ti的改变如同EJB2到EJB3的改变,旧的Struts1.3的架构被完全抛弃,吸收了更加先进的开源软件和架构之后,推出的新东西。

对于Webwork的使用者来说,获得了更加广泛的用户群体和接受度。并且核心开发团队也得到了壮大,相信未来的新版本推出速度可以更快了,而不是现在这样,对webwork2.2都望穿秋水了。

另外非常值得注意的是,Struts Ti的目标可不止集成Webwork这么简单,看看它的phase 2,集成Beehive的Page Flow,JDK1.5的annotations,目标是Ruby on Rails般的快速开发模式,多么诱人的前景!

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

 

 

 

(转帖)[译]Struts Menu开发向导

  哈,网络真是一个好东东,早就想在我们站使用菜单技术,可是我对此不熟悉,这里又有一个现存的东西可以拿来用了。

  转自:http://kb.csdn.net/java/Articles/200511/3af84c4b-0aba-47ad-9060-58f81c7592ab.html

  正文:

   您的位置:CSDN 首页 -> 知识库 -> 文章摘要

[译]Struts Menu开发向导

作者: ∣来源:BlogJava∣原文地址∣2005-11-28

 官方英文版向导(http://struts-menu.sourceforge.net/userguide.html)

一、从1.X升级到2.X需要做以下事情:

1、改变你的taglib声明中的URI。

 <% at taglib uri="http://struts-menu.sf.net/tag" prefix="menu" %>

2、改变<plug-in>,使用新的包名"net.sf.navigator." 。

 <plug-in className="net.sf.navigator.menu.MenuPlugIn">

3、改变你的menu-config.xml文件,使用新的包名"net.sf.navigator." 。

 <Displayer name="Simple"

   type="net.sf.navigator.displayer.SimpleMenuDisplayer"/>

二、快速开始:

1、下载最新的struts-menu版本;

2、解包到本地目录;

3、下载Tomcat或者其它Servlet容器;

4、把struts-menu.war包放入Tomcat安装目录的wabapps目录下,并重启Tomcat服务。

5、打开htpp://localhost:8080/struts-menu/

三、把Struts Menu整合到你的应用程序中:

Struts Menu能够被轻易的整合到你的Struts应用程序中,它也可以整合到一个非Struts的应用程序中,但是我不喜欢这样做,所以在此没有提供相应的教程。这里将一步步的带你整合这个标签库。

你需要把struts-menu.jar放到你的WEB-INF/lib目录下。然后使用URI标签声明你的JSP文件中想使用的这个标签库。

如果使用Struts Menu 2.1,你还需要 Jakarta's Standard Tag Library JAR包放入你的WEB-INF/lib目录下。下载地址:http://ibiblio.org/maven/taglibs/jars/standard-1.0.4.jar,这个文件包括例程WAR包文件和二进制发布包。

1、放入struts-menu.jar包到你的应用程序的WEB-INF/lib目录中。

2、在你的struts-config.xml文件中加入plug-in设置。

 <plug-in className="net.sf.navigator.menu.MenuPlugIn">

   <set-property property="menuConfig"

     value="/WEB-INF/menu-config.xml"/>

 </plug-in>

3、你将需要在你的应用程序的/WEB-INF/menu-config.xml文件中定义你的菜单,这里提供一个简单的片断:

 <Menu name="contactMenu" title="Contact" location="?Contact">

   <Item name="email" title="E-Mail" location="?EMail"/>

   <Item name="phone" title="Phone" location="?Phone"/>

 </Menu>

  更多全面的例程,请查看应用程序的web/WEB-INF目录中的menu-config.xml文件,你可以截取一段作为你需要的菜单。完整的属性列表,可以查看MenuBase class's javadocs(http://struts-menu.source......avigator/menu/MenuBase.html)。

4、在你的JSP文件的顶部加入taglib声明:

 <% at taglib uri="http://struts-menu.sf.net/tag" prefix="menu" %>

5、在你的JSP文件中要放置菜单的位置加入taglib代码:

 <menu:useMenuDisplayer name="TabbedMenu"

   bundle="org.apache.struts.action.MESSAGE">

   <menu:displayMenu name="Home"/>

   <menu:displayMenu name="About"/>

 </menu:useMenuDisplayer>

  属性name="TabbedMenu"被定义在menu-config.xml文件的顶部:

 <Displayer name="TabbedMenu"

   type="net.sf.navigator.displayer.TabbedMenuDisplayer"/>

(译注:其实到此步即可在你的JSP文件中添加相应的菜单了,只不过是没有结合Velocity。在menu-config.xml文件的头部可以定义多个Displayer,每个Displayer都有name和type属性,name属性与JSP文件中menu:useMenuDisplayer标签的name属性相对应,即表明使用何种样式,具体的样式定义便在type属性中定义,type属性中是一个class。在menu-config.xml文件中的菜单定义中的name属性则与JSP文件中的menu:displayMenu标签的name属性相对应。)

使用定制的Velocity模版实施你的菜单,你需要整合Velocity到你的WEB应用程序中。如果需要这样做的话,请完成下面的步骤:

1、确定你的menu-config.xml文件有“Velocity”的displayer定义:

 <Displayer name="Velocity"

     type="net.sf.navigator.displayer.VelocityMenuDisplayer"/>

2、加入Velocity的JARs包到你的WEB-INF/lib目录中,下载velocity-1.4-rc1.jar(http://www.ibiblio.org/ma......y/jars/velocity-1.4-rc1.jar)和velocity-tools-view-1.0.jar(http://www.ibiblio.org/ma......velocity-tools-view-1.0.jar)。

3、加入globalMacros.vm(http://cvs.sourceforge.net/viewcvs.py/*checkout*/struts-menu/navigator/web/WEB-INF/classes/globalMacros.vm?content-type=text%2Fplain&rev=1.1(右键另存为))到你的WEB-INF/lib目录中。

4、改变你的JSP文件中displayer的值为“Velocity”,“config”属性指向一个文件(如config="/templates/tabs.html")或者如果tabs.htm在你的WEB-INF/classes目录中的话,则可设config="tabs.html"。

这里提供了一些使用Velocity的displayer例子,可在sample application(http://demo.raibledesigns.com/struts-menu/index.jsp)中查看。它总是在你的菜单需要的时候显示CSS,JavaScript和图像文件。下面有一些在当前的Struts Menu中用到的Velocity模版的例子的链接:

 CoolMenus: Demo(http://demo.raibledesigns......menu/velocity-coolmenu4.jsp),

    Template(http://struts-menu.sourceforge.net/templates/coolmenus.html)

 NiceTabs: Demo, Template

 Tabs: Demo, Template

 XTree: Demo, Template

所有相关的有用的文件如果你需要的话都可以在下面的站点上下载:

 Images (http://struts-menu.sourceforge.net/menu-images/)

 Stylesheets (http://struts-menu.sourceforge.net/styles/)

 Scripts (http://struts-menu.sourceforge.net/scripts/)

 Templates (http://struts-menu.sourceforge.net/templates/)

更多的基于roles的显示/隐藏菜单的信息,请查看FAQs(http://struts-menu.sourceforge.net/faq.html)。

四、在Struts之外使用Struts Menu:

在2.2版中,Menu Repository能够使用MenuContextListener载入:

 <!--

    - Loads the menu-config.xml for struts-menu at startup,

    - by default from "/WEB-INF/menu-config.xml".

    - To override this, add a context-param named "menuConfigLocation"

    - web.xml file.

    -->

 <listener>

     <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>

 </listener>

或者如果你使用Spring,甚至更容易。仅仅需要加入下面的部分到你的applicationContext.xml文件中:

 <bean id="menu" class="net.sf.navigator.menu.MenuLoader">

   <property name="menuConfig">

     <value>/WEB-INF/menu-config.xml</value>

   </property>

 </bean>

 <!-- The menuConfig property is an optional attribute.  It is set to

     /WEB-INF/menu-config.xml by default. -->

感谢Dan Luputan提供MenuLoader类的源代码。

五、从源文件编译:

要从源文件编译这个项目,执行下面的步骤:

1、下载并安装Maven(http://maven.apache.org/);

2、创建一个环境变量MAVEN_HOME指出你的Maven的安装目录,然后添加$MAVEN_HOME/bin到你的PATH变量中;

3、操纵这个目录你可以扩展源代码,执行“maven.jar”创建target/struts-menu.jar。

要展开struts-menu例程,需要下面的步骤:

1、下载和安装Tomcat;

2、创建一个环境变量CATALINA_HOME指出你的Tomcat的安装目录;

3、执行“maven deploy”把应用程序展开到Tomcat中;

4、打开http://localhost:8080/struts-menu在你喜爱的浏览器中。

如果你喜欢使用Eclipse开发项目,请参考此份开发向导(http://struts-menu.sourceforge.net/devguide.html)。

Robin's Java World 2005-11-28 10:15

--------------------------------------------------------------------------------

struts国际化问题(转贴,如有侵权,请告知)

放在这里备忘。

>> 欢迎您,客人: 登录 | 注册 | 忘记密码 | 在线 | 搜索 | 帮助    |  

 

论坛全文检索:    

 

  【ChinaJavaWorld.com技术论坛】

 『 Struts 及 MVC Framework论坛 』   [返回]

   [原创]"struts中文问题&quo ...  

标记论坛所有内容为已读  

>> 『 Struts 及 MVC Framework论坛 』  欢迎您的到来 << 

    ◆您是本帖第 257 个阅读者◆        

 

  * 贴子主题: [原创]"struts中文问题","struts国际化问题"——终极解决方案                 

 

 

  baozitou007     

 

 

信息:    

威望: 0

来自: 湖北鄂州 

总发贴数: 35 篇

注册日期: 2004/01/17

 

 消息 查看 搜索 好友 邮件 QQ 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  引文

----------------------------------------

----------------------------------------

说实话,你们的方法都做的复杂了,Java本身就支持多国语言编码,不需要写任何程序,可以很简单的

实现。

秘诀就是两点:

1、所有HTML/JSP页面全部采用UTF-8编码

2、客户端浏览器完全支持UTF-8编码

步骤:

1、首先把所有的HTML/JSP的ContentType都设为UTF-8

2、然后对于JSP程序中的非ASCII码提示信息都不应该写在程序里面,都应该放在

application.properties里面统一管理。

3、对HTML用native2ascii工具统一做一次处理,把HTML中的非ASCII码都转换为Unicode编码。

4、针对不同的语言,写不同的application.properties,比如说简体中文是

application_zh_CN.properties,繁体中文是application_zh_TW.properties这样,然后对这些配置信

息文件同样用native2ascii工具处理一次,把非ASCII码统统转为Unicode编码。

5、在Servlet的request.getCharacterEncoding()获得客户端的操作系统默认编码,然后set到Struts

的HTTPSession的Locale中。

OK!现在不同的客户访问,就会显示不同的语言版本了。你可以看看此时你的浏览器的字符集,就是

UTF-8。现在你的网站和Google一样了,嘿嘿,其实你有心的话,看看你的浏览器访问Google的时候是

什么字符集吧

切记:所有的HTML/JSP都要设为UTF-8编码,所有的文件中的非ASCII码字符都要用native2ascii工具转

为用ASCII表示的Unicode编码。

----------------------------------------

----------------------------------------

原创

----------------------------------------

上面所述是我从网上下的一篇于中文问题的解决方案,确切的说应该是关于Struts的国际化问题,下面我结合我的实践谈谈具体如何实现Struts的国际化问题,我对理论不是非常精通,我只能完全凭自己的理解和实践来讲述,所以下面讲的内容可能不是非常正确,还请大家原谅。但有一点可以肯定,我通过自己的努力解决了Struts的中文问题,并实现Struts的国际化,其实一切并不复杂,下面是具体步骤:

  0.遇到的问题(这些问题也许不会同时出现)

    a.中文数据从数据库中到jsp中后就变成了"????"

    b.做好的中文properties文件,其中的中文value在页面显示乱码

    c.jsp文件中的中文到浏览器后显示时也是乱码(建议不要在jsp文件中输入中文,尽量放在properties文件中)

    d.由jsp传给bean的中文值,再由bean传回页面又是乱码

    e.当更换本地浏览器的语言选项时,Web应用程序不能自动根据你的locale选择合适的*.properties文件。导致Web应用程序不能国际化。

  1.环境:

      Web服务器: Tomcat 5.0.19

       操作系统: Win2000 Server

         JVM   : jdk 1.4

       数 据 库: Oracle 8.1.7

       开发工具: struts studio 5.2 pro   for  eclipse

  2.先将所有*.jsp 网页中开头处加入

    <%@ page language="java" contentType="text/html; charset=utf-8" %>

     再设置<html:html locale = "true">

  3.然后编辑好两个*.properties文件,放在classes文件夹下你指定的地方,这里是放在/web-inf/classes/com/wiley 下,它们分别是:

    ApplicationResources.properties  (英文资源文件)

    ApplicationResources_zh.properties (中文资源文件)

    随便用什么工具编写都行啊!

  4.将ApplicationResources_zh.properties转码成gb2312。上面引文说要转成UTF-8,结果我试了,不行。转成gb2312就行了,操作是。

    将ApplicationResources_zh.properties更名为ApplicationResources_xx.properties

    在DOS命令行进入ApplicationResources_xx.properties所在的文件夹

    使用命令:native2ascii -encoding gb2312 ApplicationResources_xx.properties ApplicationResources_zh.properties(至于你为什么会出现“native2ascii不是内部命令”,,请查其它资料,可能你要设置环境变量,因为他是jdk的文件夹bin下的一个应用程序)

   5.接下来配置struts-config.xml,很简单,我们加入:

   <message-resources parameter="com.wiley.ApplicationResources"/>  就行了;

   到此已能解决大多数中文问题。如上面所说的a,b,e 现在打开浏览器,选择菜单:工具》internet选项》语言,将“中文-中国[zh-cn]”删掉,添加一个“英语-英国[zh-gb]”确定后,重启Tomcat,输入网址你就会发现,你的页面的文本信息就会用的是ApplicationResources.properties  (英文资源文件)中的内容。如果换回“中文-中国[zh-cn]”,它就会显示ApplicationResources_zh.properties (中文资源文件)中的中文内容。

  至于问题“c.jsp文件中的中文到浏览器后显示时也是乱码” 你就要用与第4步类似的方法来重新对*.jsp 文件编码,这时-encoding的参数就要用UTF-8了,如果你用的也是struts studio 5.2 pro   for  eclipse工具,这一步就免了。它会自动用UTF-8的格式存储。

  至于问题“d.由jsp传给bean的中文值,再由bean传回页面又是乱码”的解决,我只是加了个过滤器。

你可以现在web.xml中加入:

<filter>

<filter-name>Set Character Encoding</filter-name>

<filter-class>com.wiley.SetCharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>utf-8</param-value> 

</init-param>

<init-param>

<param-name>ignore</param-name>

<param-value>true</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>Set Character Encoding</filter-name>

<servlet-name>action</servlet-name>

</filter-mapping>

  然后在你指定的包内加个java文件 我放在了/web-inf/classes/com/wiley 里,下面是源代码:

/*

* XP Forum

*

* Copyright (c) 2002-2003 RedSoft Group. All rights reserved.

*

*/

package com.huahang.tj.struts.filters;

import javax.servlet.*;

import java.io.IOException;

/**

* <p>Filter that sets the character encoding to be used in parsing the

* incoming request, either unconditionally or only if the client did not

* specify a character encoding. Configuration of this filter is based on

* the following initialization parameters:</p>

* <ul>

* <li><strong>encoding</strong> - The character encoding to be configured

* for this request, either conditionally or unconditionally based on

* the <code>ignore</code> initialization parameter. This parameter

* is required, so there is no default.</li>

* <li><strong>ignore</strong> - If set to "true", any character encoding

* specified by the client is ignored, and the value returned by the

* <code>selectEncoding()</code> method is set. If set to "false,

* <code>selectEncoding()</code> is called <strong>only</strong> if the

* client has not already specified an encoding. By default, this

* parameter is set to "true".</li>

* </ul>

*

* <p>Although this filter can be used unchanged, it is also easy to

* subclass it and make the <code>selectEncoding()</code> method more

* intelligent about what encoding to choose, based on characteristics of

* the incoming request (such as the values of the <code>Accept-Language</code>

* and <code>User-Agent</code> headers, or a value stashed in the current

* user's session.</p>

*

* @author <a href="mailto:jwtronics@yahoo.com">John Wong</a>

*

* @version $Id: SetCharacterEncodingFilter.java,v 1.1 2002/04/10 13:59:27 johnwong Exp $

*/

public class SetCharacterEncodingFilter implements Filter {

// ----------------------------------------------------- Instance Variables

/**

* The default character encoding to set for requests that pass through

* this filter.

*/

protected String encoding = null;

/**

* The filter configuration object we are associated with. If this value

* is null, this filter instance is not currently configured.

*/

protected FilterConfig filterConfig = null;

/**

* Should a character encoding specified by the client be ignored?

*/

protected boolean ignore = true;

// --------------------------------------------------------- Public Methods

/**

* Take this filter out of service.

*/

public void destroy() {

this.encoding = null;

this.filterConfig = null;

}

/**

* Select and set (if specified) the character encoding to be used to

* interpret request parameters for this request.

*

* @param request The servlet request we are processing

* @param result The servlet response we are creating

* @param chain The filter chain we are processing

*

* @exception IOException if an input/output error occurs

* @exception ServletException if a servlet error occurs

*/

public void doFilter(ServletRequest request, ServletResponse response,

FilterChain chain)

throws IOException, ServletException {

// Conditionally select and set the character encoding to be used

if (ignore || (request.getCharacterEncoding() == null)) {

String encoding = selectEncoding(request);

if (encoding != null)

request.setCharacterEncoding(encoding);

}

// Pass control on to the next filter

chain.doFilter(request, response);

}

/**

* Place this filter into service.

*

* @param filterConfig The filter configuration object

*/

public void init(FilterConfig filterConfig) throws ServletException {

this.filterConfig = filterConfig;

this.encoding = filterConfig.getInitParameter("encoding");

String value = filterConfig.getInitParameter("ignore");

if (value == null)

this.ignore = true;

else if (value.equalsIgnoreCase("true"))

this.ignore = true;

else if (value.equalsIgnoreCase("yes"))

this.ignore = true;

else

this.ignore = false;

}

// ------------------------------------------------------ Protected Methods

/**

* Select an appropriate character encoding to be used, based on the

* characteristics of the current request and/or filter initialization

* parameters. If no character encoding should be set, return

* <code>null</code>.

* <p>

* The default implementation unconditionally returns the value configured

* by the <strong>encoding</strong> initialization parameter for this

* filter.

*

* @param request The servlet request we are processing

*/

protected String selectEncoding(ServletRequest request) {

return (this.encoding);

}

}//EOC

   到此我遇到的中文问题已全部得到解决,并从中理解到struts的国际化的深刻含义。

我个人觉得struts作为一个功能强大的应用框架,应该早就考虑到它的国际化问题,并在实际应用中不会很复杂,只要我们遵循一些规则,就可以尽情享受struts给我们带来的无穷乐趣。希望以上所述对大家有所帮助。

 

 

 

 

--------------------------------------------------------------------------------

  2004/03/30 09:36am IP: 已设置保密  

 

 

 

  风行天下     

 

 

信息:    

威望: 0

来自: 北京 

总发贴数: 59 篇

注册日期: 2003/04/28

 

 消息 查看 搜索 好友 邮件 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  thanks very much

 

 

 

--------------------------------------------------------------------------------

  2004/03/30 12:07pm IP: 已设置保密  

 

 

 

  zhushilin     

  kopf43

 

信息:   

威望: 0

来自: 上海 

总发贴数: 43 篇

注册日期: 2002/07/24

 

 消息 查看 搜索 好友 邮件 QQ 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  好文章,长见识了

 

 

 

--------------------------------------------------------------------------------

  2004/03/30 01:17pm IP: 已设置保密  

 

 

 

  iamisabird     

 

 

信息:  

威望: 0

来自: 保密 

总发贴数: 17 篇

注册日期: 2004/02/21

 

 消息 查看 搜索 好友 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  我想问一下,在步骤2中提到的“非ASCII码提示信息“是指哪些东西

 

 

 

--------------------------------------------------------------------------------

  2004/03/30 11:36pm IP: 已设置保密  

 

 

 

  baozitou007     

 

 

信息:    

威望: 0

来自: 湖北鄂州 

总发贴数: 35 篇

注册日期: 2004/01/17

 

 消息 查看 搜索 好友 邮件 QQ 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  这里说的“非ASCII码提示信息”说的是在你的jsp文件中输入不是a,b,c,d......r等ASCII码表中的字符,比如说“中文”,或者是“韩文”等,这都是非“非ASCII码提示信息”例如:

    <html:html xhtml="true" locale="true">

<head>

   <title>

      <bean:message key="app.title" />

   </title>

</head>

<body>

    看来UTF-8是个好东西!

<table width="500" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td> </td>

  </tr>

  <tr bgcolor="#36566E">

    <td height="68" width="48%">

----------------------------------

其中“看来UTF-8是个好东西!”就是我们说的“非ASCII码提示信息”

 

 

 

--------------------------------------------------------------------------------

  2004/03/31 09:19am IP: 已设置保密  

 

 

 

  momocha     

 

 

信息: 

威望: 0

来自: 保密 

总发贴数: 59 篇

注册日期: 2003/06/26

 

 消息 查看 搜索 好友 邮件 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  切记:所有的HTML/JSP都要设为UTF-8编码,所有的文件中的非ASCII码字符都要用native2ascii工具转

为用ASCII表示的Unicode编码。

问个问题,你所说的这一步不太明白,是不是每一个包含非ascii的jsp/html文件都要用这个工具转换一个,能说说这个工具吗,谢谢了!!

 

 

 

 

--------------------------------------------------------------------------------

  2004/03/31 03:03pm IP: 已设置保密  

 

 

 

  baozitou007     

 

 

信息:    

威望: 0

来自: 湖北鄂州 

总发贴数: 35 篇

注册日期: 2004/01/17

 

 消息 查看 搜索 好友 邮件 QQ 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  native2ascii -encoding gb2312 jspname.jsp newjspname.jsp

  native2ascii这个工具是jdk自带的一个东东,所以如果path都设定正确就可以直接运行了,你可以在$java_home$/bin下找到他。

  所以你要设一下系统环境变量:C:\jdk\bin

 

 

 

 

--------------------------------------------------------------------------------

  2004/04/01 10:01am IP: 已设置保密  

 

 

 

  sdyjmc   头衔: 飞天

 

 

信息:   

威望: 0

来自: 其它大洋洲 

总发贴数: 886 篇

注册日期: 2001/12/21

 

 消息 查看 搜索 好友 主页 QQ ICQ 复制 引用 回复   加到"个人收藏夹"

--------------------------------------------------------------------------------

  不知数据库中的编码,在datasource中怎么解决?能够建立pool的时候指定编码?

<set-property property="weblogic.codeset" value="GBK" />

 

 

 

 

--------------------------------------------------------------------------------

  2004/04/01 04:54pm IP: 已设置保密  

 

 

 

 该主题只有一页  跳转论坛至... ╋Java 2 Platform, Standard Edition (J2SE) 与Java核心技术论坛 |-『 Java语言*初级版 』 |-『 Java语言*高级版 』 |-『 JavaGUI设计 』 |-『 Java安全版块 』 |-『 Java工具安装、配置与使用 』 |-『 Java新技术,新闻,应用与资源等 』╋Java 2 Platform, Enterprise Edition (J2EE) 技术论坛 |-『 JSP/Servlets/JSF 』 |-『 JDBC,JDO 』 |-『 EJB 』 |-『 其他J2EE技术 』╋Java 2 Platform, Micro Edition (J2ME)技术论坛 |-『 J2ME 技术论坛 』╋J2EE 应用服务器 技术论坛 |- 『 BEA WebLogic Platform 技术论坛 』 |-『 IBM WebSphere 技术论坛』 |-『 其他应用服务器技术论坛 』  ╋Web Services和XML技术 |-『 Web Services 技术论坛 』 |-『 XML技术论坛 』╋Apache Jakarta Project技术论坛 |-『 Tomcat技术论坛』   |-『 Struts 及 MVC Framework论坛 』  ╋软件过程管理,建模等 |-『 设计模式 』 |-『 UML 』 |-『 软件测试 』 |-『 软件工程,过程及项目管理 』╋Java相关认证论坛系列 |-『 SCJP认证论坛 』 |-『 Java其他认证 』╋数据库技术 |-『 Oracle&PostgreSQL技术论坛 』╋其他软件开发技术 |-『 C#和.Net技术论坛 』╋操作系统 |-『 操作系统论坛 』╋其他 |-『 休闲乐园 』 |-『 英语学习论坛 』 |-『 求职与招聘 』 |-『 广告论坛 』╋站务建设区 |-『 站务建设 』 |-『 版主专区 』   |-『 论坛公告区 』 |-『 帖子讨论专区 』╋ChinaJavaWorld服务专栏 

   快速回复主题: [原创]"struts中文问题","struts国际化问题"——终极解决方案

输入用户名和密码: 用户名:  没有注册? 密码:  忘记密码?

上传附件或图片 (最大容量 300KB)   支持类型:----------gifjpgbmpzippngswfdoctxthtmhtmlgzrartarsxw

选项

使用 LB5000 标签?

显示您的签名?

有回复时使用邮件通知您?

 

   [使用 Ctrl+Enter 直接提交贴子] 

 

 顶端 加到"个人收藏夹" 主题管理: 总固顶 | 取消总固顶 | 区固顶 | 取消区固顶 | 固顶 | 取消固顶 |

精华 | 取消精华 | 提升 | 锁定 | 解锁 | 删除 | 删除回复 | 移动 | 

  

--------------------------------------------------------------------------------

© 中文版权所有: Java开发者  版本: LB5000MX 2.00

程序版权所有: CGI 编程者之家    程序编制: 山鹰(糊)、 花无缺

本论坛言论纯属发表者个人意见,与 【ChinaJavaWorld.com技术论坛】 立场无关

 

的用法

忘性真大,一段時間不用,這些簡單的東西又要翻書了,看來,3天不用手生,3天不說口生。的確不假呀。

<html:text>和<html:textarea>标记分别HTML文本框和文本区,属性如下:

属性 描述

Property 定义当表单被提交时送回到服务器的请求参数的名称,或用来确定文本元素当前值的bean的属性名称

Name 属性被查询的bean的名称,它决定了文本框和文本区的值。如果没有设置,将使用与这个内嵌表单相关的ActionForm的名称

<html:text>标记还有以下属性:

属性 描述

Maxlength 能够输入的最大字符数

Size 文本框的大小(字符数)

(补充:这里的字符数是不论是汉字还英文,一个汉字和一个英文字符都算一个字符;与UTF-8对比为:一个汉字3个英文字符;与java中的对比:一个汉字1个英文;与gb2312对比:一个汉字2个英文字符(即2个字节))

例如:<html:text property="articleName" maxlength="50" size="50"/>