posts - 48, comments - 13, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

2009年1月19日

spket - http://www.spket.com/update

subclipse - http://subclipse.tigris.org/update

posted @ 2010-12-02 09:39 董锐 阅读(281) | 评论 (0)编辑 收藏

Tomcat启动时classloader加载顺序
  Tomcat的class加载的优先顺序一览  
  1.最先是$JAVA_HOME/jre/lib/ext/下的jar文件。  
  2.环境变量CLASSPATH中的jar和class文件。  
  3.$CATALINA_HOME/common/classes下的class文件。  
  4.$CATALINA_HOME/commons/endorsed下的jar文件。  
  5.$CATALINA_HOME/commons/i18n下的jar文件。  
  6.$CATALINA_HOME/common/lib   下的jar文件。  
  (JDBC驱动之类的jar文件可以放在这里,这样就可以避免在server.xml配置好数据源却出现找不到JDBC   Driver的情况。)  
  7.$CATALINA_HOME/server/classes下的class文件。  
  8.$CATALINA_HOME/server/lib/下的jar文件。  
  9.$CATALINA_BASE/shared/classes   下的class文件。  
  10.$CATALINA_BASE/shared/lib下的jar文件。  
  11.各自具体的webapp   /WEB-INF/classes下的class文件。  
  12.各自具体的webapp   /WEB-INF/lib下的jar文件。

posted @ 2010-11-03 11:31 董锐 阅读(1003) | 评论 (0)编辑 收藏

What this means is that leadership involves setting direction, communicating that vision passionately to those they work with, and helping the people they lead understand and commit to that vision. Managers, on the other hand, are responsible for ensuring that the vision is implemented efficiently and successfully.

posted @ 2010-08-23 16:29 董锐 阅读(439) | 评论 (0)编辑 收藏

I know how to send by jquery post method $.post("test.php", { name: "John", time: "2pm" } );

but what if my form field name is array

<input type=text name="n1[]" id="n1[]" value='12345">   <input type=text name="n1[]" id="n1[]" value="14454">  

how to send these 2 field value send to url by jquery post method?

 

You can pass in an array as a value in the object:

{name: 'John', 'nl[]': ['12345', '14454']}  

(This is documented at ajax but also works for post.)

 

var fields = $(":input").serializeArray();      $.post("test.php",fields);

from:http://stackoverflow.com/questions/1656267/how-to-send-multi-field-value-by-jquery-post

posted @ 2010-07-14 11:46 董锐 阅读(730) | 评论 (0)编辑 收藏

string.replace(new RegExp(oldString,"gm"),newString))

posted @ 2010-07-14 11:20 董锐 阅读(199) | 评论 (0)编辑 收藏

在网上看到解决方案是把注册表里(因为是windows操作系统)\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE 下的NLS_lang 的NA值修改为SIMPLIFIED CHINESE_CHINA.ZHS16GBK;
 但是我在操作的时候,只把Oracle目录下所有能找到的NLS_Lang值修改了,偏偏没有修改Oracle目录所对应的NLS_Lang值,导致一直测试不通过,始终报错,最后终于发现原来Oracle目录本身对应的NLS_lang值没有修改,修改过后,测试通过,成功!

posted @ 2010-01-14 14:45 董锐 阅读(13478) | 评论 (2)编辑 收藏

If you got this message: "Warning: Cannot modify header information - headers already sent by ...."
如果在执行php程序时看到这条警告:"Warning: Cannot modify header information - headers already sent by ...."

Few notes based on the following user posts:
有以下几种解决方法:

1. Blank lines (空白行):
Make sure no blank line after <?php ... ?> of the calling php script.
检查有<?php ... ?> 后面没有空白行,特别是include或者require的文件。不少问题是这些空白行导致的。

 

 

2. Use exit statement (用exit来解决):
Use exit after header statement seems to help some people
在header后加上exit();
header ("Location: xxx");
exit();

 

3. PHP has this annoying problem, if your HTML goes before any PHP code or any header modification before redirecting to certain page, it'll said "Warning: Cannot modify header information - headers already sent by ...." Basically anytime you output to browser, the header is set and cannot be modified.   So two ways to get around the problem:

3a. Use Javascript (用Javascript来解决):
<? echo "<script> self.location(\"file.php\");</script>"; ?>
Since it's a script, it won't modify the header until execution of Javascript.
可以用Javascript来代替header。但是上面的这段代码我没有执行成功... 另外需要注意,采用这种方法需要浏览器支持Javascript.

3b. Use output buffering (用输出缓存来解决):
<?php ob_start(); ?>
... HTML codes ...
<?php
... PHP codes ...
header ("Location: ....");
ob_end_flush();
?>
This will save the output buffer on server and not output to browser yet, which means you can modify the header all you want until the ob_end_flush() statement.   This method is cleaner than the Javascript since Javascript method assumes the browser has Javascript turn on.   However, there are overhead to store output buffer on server before output, but with modern hardware I would imagine it won't be that big of deal.   Javascript solution would be better if you know for sure your user has Javascript turn on on their browser.

就像上面的代码那样,这种方法在生成页面的时候缓存,这样就允许在输出head之后再输出header了。


————————————————————————————————————————————
结果最后还是这个问题:
原来是php.ini里面的配置出了问题,output_buffering参数默认为off的,现在将它设为”on”就OK了。

posted @ 2009-12-02 10:02 董锐 阅读(7387) | 评论 (1)编辑 收藏

1、要安装java jdk,安装tomcat
2、安装好apache,php
3、下载php-java-bridge_5.5.4_documentation.zip
4、解压缩php-java-bridge_5.5.4_documentation.zip
5、将解压缩后根目录下JavaBridge.war拷贝到tomcat服务器的webapp目录下
6、启动tomcat服务器
7、在php中使用java只需增加下面一行语句:
<php? require_once(http://127.0.0.1:8080/JavaBridge/java/Java.inc); ?>

可以了:
<php?
    $date=new Java('java.util.Date');
echo $date->getDate();
?>
运行通过,OK!

posted @ 2009-10-20 15:03 董锐 阅读(570) | 评论 (2)编辑 收藏

80端口被占用的解决方法:

cmd命令窗口
输入netstat -abn ->c:/port80.txt
然后到c盘port80.txt文件中找到占用80端口的程序pid,记下pid。打开任务管理器,点击“查看”/选择列,勾选“PID(进程标识符)”,然后单击“进程”标签,找到80端口对应的pid,就可以看到是那个程序占用的了,更改这个程序的port,再重启这个程序,使更改生效。

不管是Apache还是IIS都无法使用已被占用的端口。即每个端口只允许使用一次(一般指被一个服务程序所使用)。
如果系统内已安装IIS并使用了80端口(Http默认端口),再安装Apache,只要另选一个端口并不与其他应用冲突即可运行。例如可以将Apache监听的端口改为81或其他任何一个未被使用的端口。
Apache修改监听端口的方法为:
打开 httpd.conf
修改 Listen 80 为 Listen 81
Apache可以同时监听一个以上的端口实现多个Http服务
只要添一行 如 Listen 82 即可

posted @ 2009-09-24 14:18 董锐 阅读(1213) | 评论 (0)编辑 收藏

"^\d+$"  //非负整数(正整数 + 0)
"^[0-9]*[1-9][0-9]*$"  //正整数
"^((-\d+)|(0+))$"  //非正整数(负整数 + 0)
"^-[0-9]*[1-9][0-9]*$"  //负整数
"^-?\d+$"    //整数
"^\d+(\.\d+)?$"  //非负浮点数(正浮点数 + 0)
"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮点数
"^((-\d+(\.\d+)?)|(0+(\.0+)?))$"  //非正浮点数(负浮点数 + 0)
"^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //负浮点数
"^(-?\d+)(\.\d+)?$"  //浮点数
"^[A-Za-z]+$"  //由26个英文字母组成的字符串
"^[A-Z]+$"  //由26个英文字母的大写组成的字符串
"^[a-z]+$"  //由26个英文字母的小写组成的字符串
"^[A-Za-z0-9]+$"  //由数字和26个英文字母组成的字符串
"^\w+$"  //由数字、26个英文字母或者下划线组成的字符串 //开源代码OSPhP.COm.CN
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"    //email地址
"^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$"  //url
/^(d{2}|d{4})-((0([1-9]{1}))|(1[1|2]))-(([0-2]([1-9]{1}))|(3[0|1]))$/   //  年-月-日
/^((0([1-9]{1}))|(1[1|2]))/(([0-2]([1-9]{1}))|(3[0|1]))/(d{2}|d{4})$/   // 月/日/年
"^([w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$"   //Emil
/^((\+?[0-9]{2,4}\-[0-9]{3,4}\-)|([0-9]{3,4}\-))?([0-9]{7,8})(\-[0-9]+)?$/     //电话号码
"^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5])$"   //IP地址
//开源OSPhP.COM.CN

posted @ 2009-09-23 17:58 董锐 阅读(184) | 评论 (0)编辑 收藏

&:&amp;
": &quot;
<url address="http://data.ent.sina.com.cn/star/starlist.php?&amp;initial=A&amp;tpl=0&amp;dpc=1"></url>
<img tagText="p class=&quot;bigphoto&quot;" toExcelName="照片"></img>

posted @ 2009-09-18 13:40 董锐 阅读(141) | 评论 (0)编辑 收藏

javascript从assiic转字符:
for(var i=65;i<91;i++)
   document.write("<a href='starlist.php?"+newsearch+"&initial="+String.fromCharCode(i)+"&tpl=0&dpc=1' target='_self'>"+String.fromCharCode(i)+"</a> ");

posted @ 2009-09-15 10:05 董锐 阅读(223) | 评论 (0)编辑 收藏

DOM 是用与平台和语言无关的方式表示 XML 文档的官方 W3C 标准。DOM 是以层次结构组织的节点或信息片断的集合。这个层次结构允许开发人员在树中寻找特定信息。分析该结构通常需要加载整个文档和构造层次结构,然后才能做任何工作。由于它是基于信息层次的,因而 DOM 被认为是基于树或基于对象的。DOM 以及广义的基于树的处理具有几个优点。首先,由于树在内存中是持久的,因此可以修改它以便应用程序能对数据和结构作出更改。它还可以在任何时候在树中上下导航,而不是像 SAX 那样是一次性的处理。DOM 使用起来也要简单得多。

  另一方面,对于特别大的文档,解析和加载整个文档可能很慢且很耗资源,因此使用其他手段来处理这样的数据会更好。这些基于事件的模型,比如 SAX。
 
这种处理的优点非常类似于流媒体的优点。分析能够立即开始,而不是等待所有的数据被处理。而且,由于应用程序只是在读取数据时检查数据,因此不需要将数据存储在内存中。这对于大型文档来说是个巨大的优点。事实上,应用程序甚至不必解析整个文档;它可以在某个条件得到满足时停止解析。一般来说,SAX 还比它的替代者 DOM 快许多。


JDOM 的目的是成为 Java 特定文档模型,它简化与 XML 的交互并且比使用 DOM 实现更快。由于是第一个 Java 特定模型,JDOM 一直得到大力推广和促进。正在考虑通过“Java 规范请求 JSR-102”将它最终用作“Java 标准扩展”。从 2000 年初就已经开始了 JDOM 开发。

  JDOM 与 DOM 主要有两方面不同。首先,JDOM 仅使用具体类而不使用接口。这在某些方面简化了 API,但是也限制了灵活性。第二,API 大量使用了 Collections 类,简化了那些已经熟悉这些类的 Java 开发者的使用。

  JDOM 文档声明其目的是“使用 20%(或更少)的精力解决 80%(或更多)Java/XML 问题”(根据学习曲线假定为 20%)。JDOM 对于大多数 Java/XML 应用程序来说当然是有用的,并且大多数开发者发现 API 比 DOM 容易理解得多。JDOM 还包括对程序行为的相当广泛检查以防止用户做任何在 XML 中无意义的事。然而,它仍需要您充分理解 XML 以便做一些超出基本的工作(或者甚至理解某些情况下的错误)。这也许是比学习 DOM 或 JDOM 接口都更有意义的工作。

  JDOM 自身不包含解析器。它通常使用 SAX2 解析器来解析和验证输入 XML 文档(尽管它还可以将以前构造的 DOM 表示作为输入)。它包含一些转换器以将 JDOM 表示输出成 SAX2 事件流、DOM 模型或 XML 文本文档。JDOM 是在 Apache 许可证变体下发布的开放源码。 
       http://www.jdom.org/


最后是 DOM4J http://dom4j.sourceforge.net/

  虽然 DOM4J 代表了完全独立的开发结果,但最初,它是 JDOM 的一种智能分支。它合并了许多超出基本 XML 文档表示的功能,包括集成的 XPath 支持、XML Schema 支持以及用于大文档或流化文档的基于事件的处理。它还提供了构建文档表示的选项,它通过 DOM4J API 和标准 DOM 接口具有并行访问功能。从 2000 下半年开始,它就一直处于开发之中。

  为支持所有这些功能,DOM4J 使用接口和抽象基本类方法。DOM4J 大量使用了 API 中的 Collections 类,但是在许多情况下,它还提供一些替代方法以允许更好的性能或更直接的编码方法。直接好处是,虽然 DOM4J 付出了更复杂的 API 的代价,但是它提供了比 JDOM 大得多的灵活性。

  在添加灵活性、XPath 集成和对大文档处理的目标时,DOM4J 的目标与 JDOM 是一样的:针对 Java 开发者的易用性和直观操作。它还致力于成为比 JDOM 更完整的解决方案,实现在本质上处理所有 Java/XML 问题的目标。在完成该目标时,它比 JDOM 更少强调防止不正确的应用程序行为。

  DOM4J 是一个非常非常优秀的Java XML API,具有性能优异、功能强大和极端易用使用的特点,同时它也是一个开放源代码的软件。如今你可以看到越来越多的 Java 软件都在使用 DOM4J 来读写 XML,特别值得一提的是连 Sun 的 JAXM 也在用 DOM4J。

package com.test;

  import java.io.*;
  import java.util.*;
  import org.dom4j.*;
  import org.dom4j.io.*;

  public class MyXMLReader {

  public static void main(String arge[]) {
  long lasting = System.currentTimeMillis();
  try {
   File f = new File("data_10k.xml");
   SAXReader reader = new SAXReader();
   Document doc = reader.read(f);
   Element root = doc.getRootElement();
   Element foo;
   for (Iterator i = root.elementIterator("VALUE"); i.hasNext();) {
    foo = (Element) i.next();
    System.out.print("车牌号码:" + foo.elementText("NO"));
    System.out.println(" 车主地址:" + foo.elementText("ADDR"));
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
  System.out.println("运行时间:" + (System.currentTimeMillis() - lasting) + " 毫秒");
  }
  }

posted @ 2009-09-08 13:38 董锐 阅读(291) | 评论 (0)编辑 收藏

配置tomcat的CATALINA_PATH,记得路径后面不要带上'\'或‘;’

posted @ 2009-08-08 22:13 董锐 阅读(154) | 评论 (0)编辑 收藏

    

刚开始我将log4j.properties文件放在WEB-INF/目录下,怎么都不能产生日志到文件中,后来才发现,原来要放到WEB-INF/classes目录下才行。奇怪tapestry5为什么一定要这样安排,不知有没有什么地方是可以配置这个文件路径的。

posted @ 2009-04-28 06:26 董锐 阅读(213) | 评论 (0)编辑 收藏

    
 <target name="build" description="Compile main source tree java files into class files, generate jar files">
   <javac destdir="${build.dir}"  listfiles="true"
    debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${src.dir}"/>
    <classpath refid="master-classpath"/>
   </javac>
 </target>

最近一个新项目运行这个target总是有问题,在目标路径没有类文件产生。后来发现每次要将该工程的bulidpath做点小变化,如remove哪个路劲再添加回去,让工程重新bulid一下,在运行这个target就可以在目标路径产生类文件了,好奇怪,不知为什么,之前几个项目都是直接运行target就行了的。注:我用的是Eclipse开发工具。

posted @ 2009-04-28 06:20 董锐 阅读(920) | 评论 (2)编辑 收藏

在tapestry5的页面中,添加如下代码
@Inject
        @Service("ApplicationGlobals")
        private ApplicationGlobals applicationGlobals;

        @SetupRender
        void setListener(){
                Clock.setListener(this);
        }

public void setClockDisplay(final String output) {

Browser.withPage(ServerContextFactory.get(applicationGlobals.getServletContext()),"/manageCar/Dwrtracker", new Runnable() {
            public void run() {
               // Util.setValue("clockDisplay", output);
            System.out.println("updateClockValue");
                ScriptSessions.addFunctionCall("updateClockValue", output);
       
            }
        });
}
interface IClockListener {
 public void setClockDisplay(final String output);
}

posted @ 2009-03-23 14:40 董锐 阅读(284) | 评论 (0)编辑 收藏

 FROM :
http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.tapestry.OptionGroupModel;
import org.apache.tapestry.OptionModel;
import org.apache.tapestry.ValueEncoder;
import org.apache.tapestry.internal.OptionModelImpl;
import org.apache.tapestry5.internal.OptionGroupModelImpl;
import org.apache.tapestry.ioc.services.PropertyAccess;
import org.apache.tapestry.ioc.services.PropertyAdapter;
import org.apache.tapestry.util.AbstractSelectModel;
/** Generic selection model for a list of Objects.
* use:
* <pre>@Inject private PropertyAccess _access;</pre>
* in your page to ge the {@link PropertyAccess} service.<br>
* !Notice: you must set the created instance both as model and encoder parameter for the {@link Select} component.*/
public class GenericSelectModel<T> extends AbstractSelectModel implements ValueEncoder<T> {
private PropertyAdapter labelFieldAdapter;
private PropertyAdapter idFieldAdapter;
private Collection<T>         list;
public GenericSelectModel(Collection<T> list, Class<T> clazz, String labelField, String idField, PropertyAccess access) {
this.list = list;
if (idField != null)
this.idFieldAdapter = access.getAdapter(clazz).getPropertyAdapter(idField);
if (labelField != null)
this.labelFieldAdapter = access.getAdapter(clazz).getPropertyAdapter(labelField);
}
public void addOptionGroup(String label, boolean disabled, List<T> options) {
List<OptionModel> optionModels = new ArrayList<OptionModel>();
if (labelFieldAdapter == null) {
for (T obj : options) {
optionModels.add(new OptionModelImpl(nvl(obj), obj));
}
} else {
for (T obj : options) {
optionModels.add(new OptionModelImpl(nvl(labelFieldAdapter.get(obj)), obj));
}
}
if (optionGroups == null) {
optionGroups = new ArrayList<OptionGroupModel>();
}
optionGroups.add(new OptionGroupModelImpl(label, disabled, optionModels, new String[0]));
}
public List<OptionGroupModel> getOptionGroups() {
return null;
}
public List<OptionModel> getOptions() {
List<OptionModel> optionModelList = new ArrayList<OptionModel>();
if (labelFieldAdapter == null) {
for (T obj : list) {
optionModelList.add(new OptionModelImpl(nvl(obj)));
}
} else {
for (T obj : list) {
optionModelList.add(new OptionModelImpl(nvl(labelFieldAdapter.get(obj)), obj));
}
}
return optionModelList;
}
// ValueEncoder functions
public String toClient(T obj) {
if (idFieldAdapter == null) {
return obj + "";
} else {
return idFieldAdapter.get(obj) + "";
}
}
public T toValue(String string) {
if (idFieldAdapter == null) {
for (T obj : list) {
if (nvl(obj).equals(string)) return obj;
}
} else {
for (T obj : list) {
if (nvl(idFieldAdapter.get(obj)).equals(string)) return obj;
}
}
return null;
}
private String nvl(Object o) {
if (o == null)
return "";
else
return o.toString();
}
}

posted @ 2009-03-15 22:20 董锐 阅读(838) | 评论 (0)编辑 收藏

转自:http://www.nabble.com/sctx.getScriptSessionsByPage%28%29-problems-td19552209.html#a19552209

Hi,

Thanks for your response. So for the following code what is the updated
version?

CODE:

Update/modify the calling client only:

   WebContext wctx = WebContextFactory.get();
   if(wctx != null)
   {
     Util utilThis = new Util(wctx.getScriptSession());
     utilThis.setValue("web Page Element Name", "Web Page Element Value");
   }


import org.directwebremoting.ui.dwr.Util; /* i.e. NOT proxy.dwr.Util */
Util.setValue("web Page Element Name", "Web Page Element Value");

 

 

update all connected browsers viewing the relevant page:

 WebContext wctx = WebContextFactory.get();
 if (wctx != null)
 {
   String currentPage = wctx.getCurrentPage();
   Collection sessions = wctx.getScriptSessionsByPage(currentPage);
   Util utilAll = new Util(sessions);
   utilAll.addFunctionCall("createTable",tData);
 }

 


final Object tData = ...;
Browser.withCurrentPage(new Runnable() {
    public void run() {
        ScriptSessions.addFunctionCall("createTable", tData);
    }
});

 

 

update all browsers for a specific page (non DWR started thread)

 servletContext = WebContextFactory.get().getServletContext();
 sctx = ServerContextFactory.get(servletContext);
 if (sctx != null)
 {
    Collection sessions = sctx.getScriptSessionsByPage("/stocksdemo/");
    Util utilAll = new Util(sessions);
    utilAll.addFunctionCall("function To Call","Data to pass");
 }

 


Browser.withPage("/stocksdemo/",  new Runnable() {
    public void run() {

posted @ 2009-03-14 22:19 董锐 阅读(2902) | 评论 (0)编辑 收藏

此篇文章甚好:
http://www.ibm.com/developerworks/cn/java/j-jettydwr/index.html

下载其示例代码后,发现其使用的是dwr2.0.5的版本,
现若要使用dwr3.0,需修改以下几处代码:
ReverseAjaxTracker.java中:
import org.directwebremoting.*;
public ReverseAjaxTracker() {
    System.out.println("ReverseAjaxTracker");
  //  WebContext wctx = WebContextFactory.get();  这两行注释掉
  //  sctx = ServerContextFactory.get(wctx.getServletContext());

    RandomWalkGenerator.getInstance().addListener(this);
  }
//OnCoord方法修改为如下几句,原来的可全部注释掉
public void onCoord(final GpsCoord gpsCoord) {
    System.out.println("onCoord");
    Browser.withPage(mapPageUrl,  new Runnable() {
        public void run() {
            ScriptSessions.addFunctionCall("updateCoordinate",gpsCoord);
        }
    });

}

就可以测试通过了!

posted @ 2009-03-14 22:14 董锐 阅读(271) | 评论 (0)编辑 收藏

java.lang.ArrayIndexOutOfBoundsException
7
Stack trace
  • javassist.bytecode.StackMapTable$Walker.stackMapFrames(StackMapTable.java:192)
  • javassist.bytecode.StackMapTable$Walker.parse(StackMapTable.java:179)
  • javassist.bytecode.StackMapTable$Shifter.doit(StackMapTable.java:714)
  • javassist.bytecode.StackMapTable.shiftPc(StackMapTable.java:693)
  • javassist.bytecode.CodeIterator.insertGap0(CodeIterator.java:676)
  • javassist.bytecode.CodeIterator.insertGap(CodeIterator.java:636)
  • javassist.bytecode.CodeIterator.insertGapCore(CodeIterator.java:467)
  • javassist.bytecode.CodeIterator.insertGap(CodeIterator.java:413)
  • javassist.expr.Expr.replace0(Expr.java:298)
  • javassist.expr.FieldAccess.replace(FieldAccess.java:213)
  • org.apache.tapestry5.internal.services.InternalClassTransformationImpl$2.edit(InternalClassTransformationImpl.java:1739)
  • javassist.expr.ExprEditor.loopBody(ExprEditor.java:197)
  • javassist.expr.ExprEditor.doit(ExprEditor.java:90)
  • javassist.CtClassType.instrument(CtClassType.java:1289)
  • org.apache.tapestry5.internal.services.InternalClassTransformationImpl.replaceFieldAccess(InternalClassTransformationImpl.java:1745)
  • org.apache.tapestry5.internal.services.InternalClassTransformationImpl.performFieldTransformations(InternalClassTransformationImpl.java:1673)
  • org.apache.tapestry5.internal.services.InternalClassTransformationImpl.finish(InternalClassTransformationImpl.java:1336)
  • org.apache.tapestry5.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:172)
  • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.onLoad(ComponentInstantiatorSourceImpl.java:201)
  • javassist.Loader.findClass(Loader.java:340)
  • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$PackageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:92)
  • javassist.Loader.loadClass(Loader.java:311)
  • java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findClass(ComponentInstantiatorSourceImpl.java:292)
  • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findInstantiator(ComponentInstantiatorSourceImpl.java:272)
  • org.apache.tapestry5.internal.services.PageElementFactoryImpl.newRootComponentElement(PageElementFactoryImpl.java:262)
  • org.apache.tapestry5.internal.services.PageLoaderProcessor.loadRootComponent(PageLoaderProcessor.java:412)
  • org.apache.tapestry5.internal.services.PageLoaderProcessor.loadPage(PageLoaderProcessor.java:390)
  • org.apache.tapestry5.internal.services.PageLoaderImpl.loadPage(PageLoaderImpl.java:59)
  • org.apache.tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java:210)
  • org.apache.tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:99)
  • org.apache.tapestry5.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:51)
  • org.apache.tapestry5.internal.services.RequestSecurityManagerImpl.checkForInsecureRequest(RequestSecurityManagerImpl.java:59)
  • org.apache.tapestry5.services.TapestryModule$35.handle(TapestryModule.java:1771)
  • org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:92)
  • org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:71)
  • org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029)
  • cn.com.zzzz.store.services.AppModule$1.service(AppModule.java:88)
  • org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
  • org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
  • org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:621)
  • org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:611)
  • org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
  • org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
  • org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
  • org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
  • org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
  • org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1007)
  • org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
  • org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
  • org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:179)
  • org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  • org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  • org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  • org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
  • org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  • org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  • org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  • org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
  • org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
  • org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  • org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  • java.lang.Thread.run(Thread.java:619)


------------------------------------------------
转换.java文件时出错,错误竟然是“超出数组边界”,但文件中并没有使用任何数组,百思不得其解。

在此.java文件中有用到@ApplicationState  private User user;
但没有为user设置get和set方法,而是直接在.java文件中使用user=.....;

后修改为加上user的get和set方法,在.java文件中用setUser(....); getUser().....

上述错误解决,页面顺利显示。

posted @ 2009-03-14 19:27 董锐 阅读(547) | 评论 (0)编辑 收藏

Tapestry5ObtainingHttpServletRequest

Tapestry encapsulates the HTTP servlet request, response and session, and you should not normally need to access them directly. However, sometimes it is necessary. For example, Acegi Security stores exception messages in the HttpSession.

The underlying HTTP servlet mechanics are available via the [WWW] RequestGlobals service.

Example

    @Inject
private RequestGlobals requestGlobals;
public void onActivate(Object context) {
HttpSession session = requestGlobals.getHTTPServletRequest().getSession();
...
}

/!\ You need the servlet-api.jar in your classpath (dependency not included with tapestry quickstart).

Alternatively, you can inject the HttpServletRequest directly (at least in 5.0.13):

    @Inject
private HttpServletRequest _request;

RequestGlobals is not accessible inside of AppModule.





Copy From : http://wiki.apache.org/tapestry/Tapestry5ObtainingHttpServletRequest

posted @ 2009-03-08 23:40 董锐 阅读(549) | 评论 (0)编辑 收藏



From:  http://wiki.apache.org/tapestry/Tapestry5HowToCreateYourOwnComponents

posted @ 2009-03-08 23:27 董锐 阅读(191) | 评论 (0)编辑 收藏

Tapestry5的错误提示真的是非常详细,它不但指出错误在哪?还会把正确的信息都列出来哦,下面的错误提示把所有可用的service都列出来了,非常方便!
------------
@Inject
 @Service("HttpSession")
 private HttpSession session;
此处出错----------

Defined services: ActionRenderResponseGenerator, AjaxComponentEventRequestHandler, AjaxComponentEventResultProcessor, AjaxPartialResponseRenderer, Alias, AliasOverrides, ApplicationDefaults, ApplicationGlobals, ApplicationInitializer, ApplicationStateManager, ApplicationStatePersistenceStrategySource, AspectDecorator, AssetBindingFactory, AssetObjectProvider, AssetSource, BSFServiceImpl, BaseURLSource, BeanBlockOverrideSource, BeanBlockSource, BeanModelSource, BindingSource, ChainBuilder, ClassNameLocator, ClasspathAssetAliasManager, ClasspathAssetFactory, ClasspathURLConverter, ClientPersistentFieldStorage, ClientPersistentFieldStrategy, ComponentClassCache, ComponentClassFactory, ComponentClassResolver, ComponentClassTransformWorker, ComponentClassTransformer, ComponentDefaultProvider, ComponentEventRequestHandler, ComponentEventResultProcessor, ComponentInstanceResultProcessor, ComponentInstantiatorSource, ComponentInvocationMap, ComponentMessagesSource, ComponentSource, ComponentTemplateSource, Context, ContextAssetFactory, ContextPathEncoder, ContextValueEncoder, CookieSink, CookieSource, Cookies, CtClassSource, DataTypeAnalyzer, DefaultDataTypeAnalyzer, DefaultFileItemFactory, DefaultHibernateConfigurer, DefaultImplementationBuilder, EndOfRequestListenerHub, Environment, EnvironmentalShadowBuilder, ExceptionAnalyzer, ExceptionTracker, FactoryDefaults, FieldTranslatorSource, FieldValidationSupport, FieldValidatorDefaultSource, FieldValidatorSource, FormSupport, FreeMarkerService, GoogleMapService, HibernateEntityPackageManager, HibernateSessionManager, HibernateSessionSource, HibernateTransactionDecorator, HiddenFieldLocationRules, HiveMind, HttpServletRequest, HttpServletRequestHandler, IgnoredPathsFilter, ImageServiceImpl, InjectionProvider, InternalRequestGlobals, JasperReportsService, LinkFactory, LocalizationSetter, LocationRenderer, LoggingDecorator, MarkupRenderer, MarkupWriterFactory, MasterDispatcher, MasterObjectProvider, MessageBindingFactory, MetaDataLocator, MultipartDecoder, NullFieldStrategyBindingFactory, NullFieldStrategySource, ObjectRenderer, PageActivationContextCollector, PageContentTypeAnalyzer, PageDocumentGenerator, PageElementFactory, PageLoader, PageMarkupRenderer, PagePool, PageRenderQueue, PageRenderRequestHandler, PageResourcesSource, PageResponseRenderer, PageTemplateLocator, PartialMarkupRenderer, PersistentFieldManager, PersistentLocale, PipelineBuilder, PropBindingFactory, PropertyAccess, PropertyConduitSource, PropertyShadowBuilder, RegistryStartup, RenderSupport, Request, RequestExceptionHandler, RequestGlobals, RequestHandler, RequestPageCache, RequestPathOptimizer, RequestSecurityManager, ResourceCache, ResourceDigestGenerator, ResourceStreamer, Response, ResponseRenderer, ServiceLifecycleSource, ServletApplicationInitializer, Session, SessionApplicationStatePersistenceStrategy, StrategyBuilder, SymbolSource, TemplateParser, ThreadLocale, ThumbnailService, TranslateBindingFactory, TranslatorSource, TypeCoercer, URIAssetAliasManager, URIAssetFactory, URLEncoder, UpdateListenerHub, ValidateBindingFactory, ValidationConstraintGenerator, ValidationMessagesSource, ValueEncoderSource, VelocityService, WebApplicationContext, applicationEventMulticaster, dataSource, messageSource, org.springframework.aop.config.internalAutoProxyCreator, org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0, productDao, productService, propertyConfigurer, sqlMapClient, transactionManager, txAdvice, user, userDao, userService.

posted @ 2009-03-08 10:37 董锐 阅读(315) | 评论 (0)编辑 收藏

开始加入t5c-commons-0.5.18.jar时,一直不知道使用里面组件时前缀该如何写,后来才知道org.apache.tapestry.commons包下TapestryCommonsModule类里 public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration)
    {
        configuration.add(new LibraryMapping("t5components", "org.apache.tapestry.commons"));
        configuration.add(new LibraryMapping("commons", "org.apache.tapestry.commons"));
    }
这个地方定义了前缀。
从这里可以看出,这个包下t5components和commons两个前缀都可以用。
<t:t5components/AjaxCheckbox></t:t5components/AjaxCheckbox>

posted @ 2009-03-04 14:53 董锐 阅读(172) | 评论 (0)编辑 收藏

本来tapesty5有很精确的错误提示,但是我的怎么就没有了呢?
后来在网上找到这样一句话:
tapestry5有个production-mode,默认的为true,可以在作为产品发布时,提供精简的错误信息,在开发时,异常信息当然是越精确越好,而且精确的异常信息也是tapestry的强项,可以很准确的告诉您错误出在哪里,所以在开发时这个选项要关掉,选中运行配置中的arguments标签,在vm
arguments中添加-Dtapestry.production-mode=false

出处:http://tapestry.javaeye.com/blog/191803

我于是在jvm arguments中添加了-Dtapestry.production-mode=false,果然可以了!!谢谢这位仁兄!



//////////////////////////////////////////////////////////////////////////////////
上述问题的另外解决方法:不在jvm中添加参数,而是在service包下增加下面这个文件:


import java.io.IOException;

import org.apache.tapestry5.*;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Local;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.RequestFilter;
import org.apache.tapestry5.services.RequestHandler;
import org.apache.tapestry5.services.Response;
import org.slf4j.Logger;

/**
 * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
 * configure and extend Tapestry, or to place your own service definitions.
 */
public class AppModule
{
    public static void bind(ServiceBinder binder)
    {
        // binder.bind(MyServiceInterface.class, MyServiceImpl.class);
       
        // Make bind() calls on the binder object to define most IoC services.
        // Use service builder methods (example below) when the implementation
        // is provided inline, or requires more initialization than simply
        // invoking the constructor.
    }
   
   
    public static void contributeApplicationDefaults(
            MappedConfiguration<String, String> configuration)
    {
        // Contributions to ApplicationDefaults will override any contributions to
        // FactoryDefaults (with the same key). Here we're restricting the supported
        // locales to just "en" (English). As you add localised message catalogs and other assets,
        // you can extend this list of locales (it's a comma separated series of locale names;
        // the first locale name is the default when there's no reasonable match).
       
        configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,zh_cn");

        // The factory default is true but during the early stages of an application
        // overriding to false is a good idea. In addition, this is often overridden
        // on the command line as -Dtapestry.production-mode=false
        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");//有了这句就不用加jvm arguments了
        
        configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "false");
        configuration.add(SymbolConstants.CHARSET, "UTF-8");
       
    }
   

    /**
     * This is a service definition, the service will be named "TimingFilter". The interface,
     * RequestFilter, is used within the RequestHandler service pipeline, which is built from the
     * RequestHandler service configuration. Tapestry IoC is responsible for passing in an
     * appropriate Logger instance. Requests for static resources are handled at a higher level, so
     * this filter will only be invoked for Tapestry related requests.
     *
     * <p>
     * Service builder methods are useful when the implementation is inline as an inner class
     * (as here) or require some other kind of special initialization. In most cases,
     * use the static bind() method instead.
     *
     * <p>
     * If this method was named "build", then the service id would be taken from the
     * service interface and would be "RequestFilter".  Since Tapestry already defines
     * a service named "RequestFilter" we use an explicit service id that we can reference
     * inside the contribution method.
     */   
    public RequestFilter buildTimingFilter(final Logger log)
    {
        return new RequestFilter()
        {
            public boolean service(Request request, Response response, RequestHandler handler)
                    throws IOException
            {
                long startTime = System.currentTimeMillis();

                try
                {
                    // The responsibility of a filter is to invoke the corresponding method
                    // in the handler. When you chain multiple filters together, each filter
                    // received a handler that is a bridge to the next filter.
                   
                    return handler.service(request, response);
                }
                finally
                {
                    long elapsed = System.currentTimeMillis() - startTime;

                    log.info(String.format("Request time: %d ms", elapsed));
                }
            }
        };
    }

    /**
     * This is a contribution to the RequestHandler service configuration. This is how we extend
     * Tapestry using the timing filter. A common use for this kind of filter is transaction
     * management or security. The @Local annotation selects the desired service by type, but only
     * from the same module.  Without @Local, there would be an error due to the other service(s)
     * that implement RequestFilter (defined in other modules).
     */
    public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
            @Local
            RequestFilter filter)
    {
        // Each contribution to an ordered configuration has a name, When necessary, you may
        // set constraints to precisely control the invocation order of the contributed filter
        // within the pipeline.
       
        configuration.add("Timing", filter);
    }
}


posted @ 2009-03-04 13:59 董锐 阅读(510) | 评论 (0)编辑 收藏

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>加上面这句才支持中文</title>
</head>
<body>
加上面这句才支持中文
</body>
</html>


/////////////////////////////////


import java.io.IOException;

import org.apache.tapestry5.*;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Local;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.RequestFilter;
import org.apache.tapestry5.services.RequestHandler;
import org.apache.tapestry5.services.Response;
import org.slf4j.Logger;

/**
 * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
 * configure and extend Tapestry, or to place your own service definitions.
 */
public class AppModule
{
    public static void bind(ServiceBinder binder)
    {
        // binder.bind(MyServiceInterface.class, MyServiceImpl.class);
       
        // Make bind() calls on the binder object to define most IoC services.
        // Use service builder methods (example below) when the implementation
        // is provided inline, or requires more initialization than simply
        // invoking the constructor.
    }
   
   
    public static void contributeApplicationDefaults(
            MappedConfiguration<String, String> configuration)
    {
        // Contributions to ApplicationDefaults will override any contributions to
        // FactoryDefaults (with the same key). Here we're restricting the supported
        // locales to just "en" (English). As you add localised message catalogs and other assets,
        // you can extend this list of locales (it's a comma separated series of locale names;
        // the first locale name is the default when there's no reasonable match).
       
        configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,zh_cn");

        // The factory default is true but during the early stages of an application
        // overriding to false is a good idea. In addition, this is often overridden
        // on the command line as -Dtapestry.production-mode=false
        configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
       
        configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "false");
        configuration.add(SymbolConstants.CHARSET, "UTF-8");//有了这句不知是不是可以不要用上面那句了,还没试过
        
    }
   

    /**
     * This is a service definition, the service will be named "TimingFilter". The interface,
     * RequestFilter, is used within the RequestHandler service pipeline, which is built from the
     * RequestHandler service configuration. Tapestry IoC is responsible for passing in an
     * appropriate Logger instance. Requests for static resources are handled at a higher level, so
     * this filter will only be invoked for Tapestry related requests.
     *
     * <p>
     * Service builder methods are useful when the implementation is inline as an inner class
     * (as here) or require some other kind of special initialization. In most cases,
     * use the static bind() method instead.
     *
     * <p>
     * If this method was named "build", then the service id would be taken from the
     * service interface and would be "RequestFilter".  Since Tapestry already defines
     * a service named "RequestFilter" we use an explicit service id that we can reference
     * inside the contribution method.
     */   
    public RequestFilter buildTimingFilter(final Logger log)
    {
        return new RequestFilter()
        {
            public boolean service(Request request, Response response, RequestHandler handler)
                    throws IOException
            {
                long startTime = System.currentTimeMillis();

                try
                {
                    // The responsibility of a filter is to invoke the corresponding method
                    // in the handler. When you chain multiple filters together, each filter
                    // received a handler that is a bridge to the next filter.
                   
                    return handler.service(request, response);
                }
                finally
                {
                    long elapsed = System.currentTimeMillis() - startTime;

                    log.info(String.format("Request time: %d ms", elapsed));
                }
            }
        };
    }

    /**
     * This is a contribution to the RequestHandler service configuration. This is how we extend
     * Tapestry using the timing filter. A common use for this kind of filter is transaction
     * management or security. The @Local annotation selects the desired service by type, but only
     * from the same module.  Without @Local, there would be an error due to the other service(s)
     * that implement RequestFilter (defined in other modules).
     */
    public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
            @Local
            RequestFilter filter)
    {
        // Each contribution to an ordered configuration has a name, When necessary, you may
        // set constraints to precisely control the invocation order of the contributed filter
        // within the pipeline.
       
        configuration.add("Timing", filter);
    }
}

posted @ 2009-03-04 10:38 董锐 阅读(894) | 评论 (1)编辑 收藏

  • java.lang.ClassNotFoundException
    caught an exception while obtaining a class file for cn.com.eTrans.manageCar.pages.Login
    exception
    org.apache.tapestry5.internal.services.TransformationException: javassist.NotFoundException: org.apache.tapestry.commons.components.AjaxCheckbox
  • org.apache.tapestry5.internal.services.TransformationException
    javassist.NotFoundException: org.apache.tapestry.commons.components.AjaxCheckbox

  • 这个问题我想了好久,也盯着它看了好久,我真是不解,org.apache.tapestry.commons.components.AjaxCheckbox明明就在那,怎么会找不到呢?

    后来终于找到原因了:
    没有将t5c-commons-0.5.18.jar包放在web-info/lib下!!!!
    tapestry5是按自己的方式找文件的,不在web-info在的找不到!!!!

    posted @ 2009-02-27 18:00 董锐 阅读(138) | 评论 (0)编辑 收藏

    java.lang.IllegalArgumentException
    Unable to resolve 't5components/AjaxCheckbox' to a component class name. Available component types: ActionLink, AddRowLink, AjaxFormLoop, Any, BeanDisplay, BeanEditForm, BeanEditor, Checkbox, DateField, Delegate, Errors, EventLink, ExceptionDisplay, Form, FormFragment, FormInjector, Grid, GridCell, GridColumns, GridPager, GridRows, If, Label, LinkSubmit, Loop, Output, OutputRaw, PageLink, Palette, PasswordField, PropertyDisplay, PropertyEditor, Radio, RadioGroup, RemoveRowLink, RenderObject, Select, Submit, SubmitNotifier, TextArea, TextField, TextOutput, Unless, Zone.



    如何解决?待续

    后来终于找到原因了:
    没有将t5c-commons-0.5.18.jar包放在web-info/lib下!!!!
    tapestry5是按自己的方式找文件的,不在web-info在的找不到!!!!

    posted @ 2009-02-27 14:13 董锐 阅读(548) | 评论 (0)编辑 收藏

    记录下载安装及破解所查看的一些网站和资料:

        rational rose下载:

      http://tseg.org/~dxiao/SEPractice/Rational2003/RationalRoseEnterpriseEditionforWindows.2003.06.00.391.000.exe

    1.安装Rose,默认是需要许可证书的..去下载个破解的..
    http://www.cnblogs.com/Files/lixianhuei/rose2003crack.rar
    2.先用破解压缩包里的 rational.exelmgrd.exe 覆盖到你的 \安装目录的Rartional\commen\

    3.然后记事本打开 license.dat, 修改里面的 SERVER yourPC ANY DAEMON rational "C:\Program Files\Rational\Common\rational.exe"
    改成 SERVER 你的机器名 ANY DAEMON rational "你的安装目录\rational.exe" ,拷贝到Common目录下..

    4. Flexlm.cpl拷贝到C:\winnt\system32\下, 在控制面板里运行 FlexLm License Manager
    运行后, Setup 面板配置文件路径,lmgrd.exe -> 你的安装目录 \Common\lmgrd.exe, License File 为你改过的 license.dat ...

    (我用的是xp,目录为C:\WINDOWS\system32


    5.
    Control面板点击Start,如果成功的话点击Status按钮将显示 你的机器名:license server UP (MASTER) 说明成功了
    失败的话重启一下FlexLm License Manager就没问题了。

    6.如果弹出对话框License Key Administrator Wizard, 选定Point to a Rational License Server to get my licenses,单击下一步,
    Server Name
    文本框中填写你的机器号(可能已经填好),单击完成。 (成功的话会出现两屏的licenses)

    posted @ 2009-02-22 14:43 董锐 阅读(661) | 评论 (0)编辑 收藏

    下载apache-maven-2.0.9-bin软件包,在path里加上了bin路径,运行mvn -version总是出现java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher 的错误,重新下载了maven-2.0.5-bin.zip将path路径改为\maven-2.0.5-bin\maven-2.0.5\bin,并增加了一个M2_HOME路径\maven-2.0.5-bin\maven-2.0.5,再次运行成功!在\maven-2.0.5-bin\maven-2.0.5\core\boot 路径下classworlds-1.1.jar包里就有要找的文件org.codehaus.classworlds.Launcher!

    posted @ 2009-02-17 14:33 董锐 阅读(6142) | 评论 (0)编辑 收藏

    在tapestry4中使用了session值,要记得在pageBeginRender中第一次进入清空,其后不需清空。

    posted @ 2009-02-13 17:10 董锐 阅读(135) | 评论 (0)编辑 收藏

    什么是Tapestry?
    欢迎来到Tapestry世界!
    本文是一篇帮助人们使用Tapestry5来创建应用程序的指导文章。不论你是否会使用Tapestry4(或Tapestry3)或者你对Tapestry完全陌生,都不影响你阅读此篇指南,事实上你对一般的互联网程序开发知道的越少,Tapestry则对你是越好的选择,因为你可以少学很多!
      当然你还是需要知道以下一些知识:HTML、XML,基本的Java语言特性和一些新一点的东西如Java Annotations.
    如果你是用servlets、JSP或Struts来开发互联网应用程序的,或许你已对很多麻烦的事情习以为常了。或许你并没有意识到你所处的可怕处境。这些环境没有安全保障;Struts和Servlet API不知道你程序的架构是如何的,不知道各个不同的块是如何连接起来的。任何一个URL地址都可以是一个Action并且每个Action都可以前进到任何一个显示页面(通常是JSP页面),这些显示页面会生成返回到客户端浏览器的HTML页面。作为一个开发者,你必须要做出一系列永无止尽的小而重要的决定(并且要与你的开发团队进行协商),如actions、页面、属性等的命名规范、变量存放在HttpSession中还是存放在HttpServletRequest中等等,这些都是麻烦的事情。
    传统方式将很多你不想要的东西推向你:多线程编程。还记得以前学习面向对象编程?一个对象可以定义为一组数据以及对这些数据进行操作的集合?当你开始互联网编程后你就必须忘记这个课程,因为互联网编程是多线程的。一个应用服务器可以处理来自单个用户的几十、上百个请求,每一个用户都有自己的线程,而且每一个用户都共享相同的对象。 突然,你发现不能在一个对象(一个servlet或一个struts Action)中存储数据,因为不论你为一个用户存放什么数据,它都会立马被某个其他用户的数据覆盖。
    更糟的是,你的每个对象都有一个方法:doGet()或doPost()。
    期间你每天工作的大部分内容是决定如何将你已经存储在java对象中的数据给打包然后把这些数据挤压进一个URL地址的请求参数里,然后你得再写些代码把这些数据给转换回来。同时要记得修改一大堆存储在servlet容器或Struts框架中的XML文件,让它们知道这些决定。

    posted @ 2009-02-05 15:03 董锐 阅读(215) | 评论 (0)编辑 收藏

    22 <component id="aPersonSelect" type="PropertySelection">
    23 <binding name="model" value="ognl:personSelectModel"/>
    24 <binding name="value" value="ognl:components.table.tableRow.aPerson"/>
    25 </component>

    ognl:OgnlException:source is null for getProperty(null, "aPerson")

    错误描述:这是一个component中一个表A,还有一个表B,最初是表A显示,表B隐藏,显示没有问题,然后点击component中一个按钮,隐藏表A,显示表B,就出现这样的错误。

    判断1:以为表A的数据源没有在Session保存,导致点击按钮重新装载页面时数据源为空,所以出现此错误,就将数据源改为session状态,还是有此错误
    判断2:表A和表B是共用同一数据源,只是Column值有变化,修改为只用一个表,点击按钮时setColumn赋不同值,测试发现点击后表格内容没有变化,赋Column值失败
    判断3:还是表A和表B,此次表A和表B使用不同数据源变量,点击按钮时表A数据表中内容选取部分赋给表B数据源,点击按钮,依然出现上述错误。

    错误未解决:
    待续。。。
    -------------------------------------------
    判断4:<td jwcid="aPersonColumnValue@Block"><span jwcid="aPersonSelect" /></td>
    在.html文件中屏蔽此句,没有错误。
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    终于找到错误原因了:
    原来表A和表B的列名相同,都用了aPerson,所以当显示表B时,为表A所用的<td jwcid="aPersonColumnValue@Block"><span jwcid="aPersonSelect" /></td>也为表B所用了,而表B的aPerson用的是:aPerson:aPerson.name,所以每次获取aPerson值都为空,修改表B的column为aPerson1:aPerson.name即成功!!
    找了这么久,原来是这个错误,汗!!!!

    posted @ 2009-02-01 10:57 董锐 阅读(216) | 评论 (0)编辑 收藏

    如果propertySelection中是复杂对象,一定记得要重载public boolean equals(Object obj)方法才可以顺利选中初始值哦!

    posted @ 2009-01-22 18:07 董锐 阅读(171) | 评论 (0)编辑 收藏

    http://tapestry.apache.org/tapestry5/guide/persist.html

    Most instance variables in Tapestry are automatically cleared at the end of each request.
    通常每次请求结束,Tapestry会将实例变量清空。

    This is important, as it pertains to how Tapestry pages are pooled and shared, over time, by many users.
    这很重要,因为Tapestry的页面是在缓冲池中被许多用户共享的。

    However, you often want to store some persistent data on a page, and have access to it in later requests.
    然而,你通常希望在页面存储一些持久数据,这样后面的请求可以得到这些数据。

    This is accomplished with the Persist annotation.

    This annotation is applied to private instance fields.

      @Persist
    private int value;

    Annotated fields will store their state between requests. Generally, speaking, this means that the value is stored into the session (but other approaches are possible).

    Whenever you make a change to a persistent field, its value is stored.

    On later requests, the value for such persistent fields is reloaded from storage.



    Persistence Strategies

    The value for each field is the strategy used to store the field between requests.

    session strategy

    The session strategy stores field changes into the session; the session is created as necessary.

    A suitably long session attribute name is used; it incorporates the name of the page, the nested component id, and the name of the field.

    Session strategy is the default strategy used unless otherwise overridden.

    Session策略是默认策略。

    flash strategy

    The flash strategy stores information in the session as well, just for not very long. Values are stored into the session, but then deleted from the session as they are first used to restore a page's state.

    The flash is typically used to store temporary messages that should only be displayed to the user once.

    client strategy

    The field is persisted onto the client; you will see an additional query parameter in each URL (or an extra hidden field in each form).


    Client  持久花费的代价要高些,它会在渲染页面的每个链接后面加上数百字节的额外信息。

    Client persistence is somewhat expensive. It can bloat the size of the rendered pages by adding hundreds of characters to each link. There is extra processing on each request to de-serialize the values encoded into the query parameter.

    Client persistence does not scale very well; as more information is stored into the query parameter, its length can become problematic. In many cases, web browsers, firewalls or other servers may silently truncate the URL which will break the application. 有时URL地址太长会被截掉。

    Use client persistence with care, and store a minimal amount of data. Try to store the identity (that is, primary key) of an object, rather than the object itself.

    posted @ 2009-01-21 16:49 董锐 阅读(210) | 评论 (0)编辑 收藏

    Iterative Development and the unified process
    People are more important than any process.
    Good people with a good process will outperform good people with no process every time.
            --Grady Booch

    Case Study: The NextGen PosSystem
    Few things are harder to put up with than a good example.
            --Mark Twain

    Inception
    The best is the enemy of the good!
            --Voltaire

    Understanding requirements
    Ours is a world where people don't know what they want and are willing to go through hell to get it.
            --Don Marquis

    Use-Case Model: Writing requirements in Context
    The indispensable first step to getting the things you want out of life:decide what you want.
            --Ben Stein

    Identifying other requirements
    When ideas fail, words come in very handy.
            --Johann Wolfgang von Goethe

    From inception to elaboration
    The hard and stiff breaks. The supple prevails.
            --Tao Te Ching

    Use-Case Model: Drawing System Sequence Diagrams
    In theory, there is no difference between theory and practice. But, in practice, there is.
            --Jan L.A. van de Snepscheut

    Domain Model: Visualizing Concepts
    It's all very well in practice, but it will never work in theory.
            --anonymous management maxim

    Domain Model: Adding Attributes
    Any sufficiently advanced bug is indistinguishable from a feature.
            --Rich Kulawiec

    Use-Case Model: Adding Detail With Operation Contracts
    Fast, Cheap, Good: Choose any two.
        --anonymous

    From Requirements to Design in this iteration
    Hardware,n.: The parts of a computer system that can be kicked.
        --anonymous

    Iteration Diagram Notation
     Cats are smarter than dogs. You can't get eight cats to pull a sled through snow.
        --Jeff Valdez

    GRASP:Designing Objects with responsibilities
    The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
        --Nathaniel Borenstein

    Design Model: Use-Case Realizations With GRASP Patterns
    To invent, you need a good imagination and a pile of junk.
        --Thomas Edison

    Design Model: Determining Visibility
    A mathematician is a device for turning coffee into theorems.
        --Paul Erdos

    Design Model: Creating Design Class Diagrams
    To iterate is human, to recurse, divine.
        --anonymous

    Implementation Model: Mapping Designs To Code
    Beware of bugs in the above code; I have only proved it correct, not tried it.
        --Donald Knuth

    GRASP:More patterns for assigning responsibilities
    Luck is the residue of design.
        --Branch Rickey

    Designing Use-Case Realizations with GoF Design Patterns
    Anything you can do, I can do meta.
            --Daniel Dennett

    Relating Use Cases
    Why do programmers get Halloween and Christmas mixed up? Because OCT(31)=DEC(25)

    Modeling Generalization
    Crude classifications and false generalizations are the curse of the organized life.
        --A generalization by H.G.Wells

    Refining the Domain Model
    PRESENT, n. That part of eternity dividing the domain of disappointment from the realm of hope.
        --Ambrose Bierce

    Adding new SSDs and Contracts
    Virtue is insufficient temptation.
        --George Bernard Shaw

    Modeling Behavior in statechart diagrams
    Usability is like oxygen--you never notice it until it is missing.
      --anonymous

    Designing the logical architecture with patterns
    0x2B | ~0x2B
            --Hamlet

    Organizing the design and implementation model packages
    If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens?
        --Seymour Cray

    Introduction To Architectual Analysis and the SAD
    Error, no keyboard ~ press F1 to continue.
        --early PC BIOS message

    Designing more use-case realizations with objects and patterns
    On two occasions I have been asked (by memebers of Parliament), "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehand the kind of confusion of ideas that could provoke such a question.
         --Charles Babbage

    Designing  a persistence framework with patterns
    Time is a good teacher, but unfortunately it kills all its pupils.
        --Hector Berlioz

    On drawing and tools
    Bubbles don't crash.
      --Bertrand Meyer

    Introduction to iterative planning and project isssues
    Prediction is very difficult, especially if it's about the future.
        --anonymous

    Comments on Iterative Development and the UP
    You should use iterative development only on projects that you want to succeed.
        --Martin Fowler

    posted @ 2009-01-19 03:59 董锐 阅读(206) | 评论 (0)编辑 收藏

        Analysis: do the right thing;
        Design: do the thing right!

    posted @ 2009-01-19 03:10 董锐 阅读(111) | 评论 (0)编辑 收藏