关于作者

用户名:snowyvalley
笔名:snowyvalley
地区:
行业:其他

日历  

快速登录

+ 用户名:
+ 密 码:

在线留言



Blog

访问统计:
文章个数:125
评论个数:166
留言条数:2




Powered by BlogDriver 2.1

寒雪谷

 

并非精通java,但却专注java!

文章

从windows下背叛
摘要:从windows下背叛 ——从windows转向linux的过程 关键字:linux suse sled 企业桌面 jbuilder msn QQ 常用软件 snowyvalley linux安装 版本:v1.0 1前言: 曾经在redhat 9.0的时候(可能是2003年),有过一次从windows下叛逃的经历,但当时主要是报着新奇的感觉进行尝试,没有这次的决心而已,那时在使用linux(redhat)时,感觉不是很爽,中文的乱码,界面上也很不方便,字符界面下敲几次命令,体会一下当年的dos情节,有几分黑客的感觉 查看全文

- 作者: snowyvalley 2006年09月13日, 星期三 16:15  回复(0) |  引用(0) 加入博采

猫生病了

猫生病了,老鼠大声朗诵诗集,并修剪盆花.
猫生病了,老鼠慢慢刷牙洗脸,并打扫房间.
猫生病了,老鼠倚在窗边欣赏夜色,并对流星许愿.
猫生病了,老鼠也病了,
它说:"我还是习惯那种时时紧张,处处小心,夜夜逃亡的生活."
午夜,我听到老鼠在叹息,且不再读诗了

网上发现的一个人的签名,细细想来好有意思呀。

- 作者: snowyvalley 2006年04月11日, 星期二 18:05  回复(1) |  引用(0) 加入博采

一个震惊了整个德国的动人故事
摘要:下面这个故事是我很久以前的收藏,也不知道摘自哪里,今天翻开看时,还是很感动,每个人都要有一个你擅长的东西,这样你在这个社会中才是有价值的个体。 查看全文

- 作者: snowyvalley 2006年04月2日, 星期日 15:29  回复(1) |  引用(0) 加入博采

要回家过年了!
要回家过年了,1.24号踏上回家的旅程(深圳-北京-长春),同时祝所有回家的朋友一路顺风,明年在维护我的Blog了!明年见!

- 作者: snowyvalley 2006年01月22日, 星期日 16:26  回复(3) |  引用(0) 加入博采

祝福大家06年好运

祝福大家06年好运,也祝福自己06年一切顺利。

- 作者: snowyvalley 2006年01月4日, 星期三 08:58  回复(0) |  引用(0) 加入博采

祝所有来访者圣诞节快乐!
祝所有来访者圣诞节快乐!明年更美好!

- 作者: snowyvalley 2005年12月25日, 星期日 08:31  回复(0) |  引用(0) 加入博采

一个关于奔跑的故事
摘要:静谧的非洲大草原上,夕阳西下,这时,一头狮子在沉思,明天当太阳升起,我要奔跑,以追上跑得最慢的羚羊;此时,一只羚羊也在沉思,明天当太阳升起,我要奔跑,以逃脱跑得最快的狮子。故事结尾,无论你是狮子或是羚羊,当太阳升起,你要做的,就是奔跑。 查看全文

- 作者: snowyvalley 2005年12月12日, 星期一 09:40  回复(0) |  引用(0) 加入博采

手把手教你删除系统顽固文件【多图】
摘要:俗话说得好,请神容易送神难,出于某种需要安装了一些软件,当不再需要使用它们时,诸如非法删除、软件非法关闭、软件自身的BUG等方面的原因,常常会出现该软件不能卸载或卸载不完全等现象,有时候我们在删除某个文件或文件夹时,系统提示无法删除,这的确令人十分头疼,现在我们就来看看解决的办法。 查看全文

- 作者: snowyvalley 2005年12月12日, 星期一 09:14  回复(0) |  引用(0) 加入博采

how to Use LookupDispatchAction

Use LookupDispatchAction for a JavaScript-free dispatch
Many forms can be put to multiple uses. The fields we need to create a record are usually the same fields we use to update a record. Likewise, the same page can usually used to identify a record to delete, copy, or update a record.

A DispatchAction (see Tip #2) is a convenient way to collect related operations like this into a single Struts Action class. A field in the request identifies the operation, and so all the developer has to do is get the right value into the field. The simplest way to do this is to label the buttons for the operation, and give each button the same name. But that ties the presentation label to the business operation and confounds localization.

As an alternative, most developers use a JavaScript attached to the button to update the dispatch field, which in practice works quite well. If JavaScript is not enabled, the submit fails gracefully, and in practice most applications do rely JavaScript for essential operations.

If JavaScript is not an option, another good alternative is the LookupDispatchAction [org.apache.struts.actions.LookupDispatchAction]. This object is a little more work to setup that the original DispatchAction, but lets you use this technique without using JavaScript as a crutch.

As with the DispatchAction, the first step is to indicate the name of the dispatch parameter in the action-mapping element. In this case the parameter will the name given to each of the buttons, rather than a hidden field. Let's just call our buttons "submit", which is the default name the html:submit tag will use.

type="org.example.MyAction"
name="MyForm"
scope="request"
input="/test.jsp"
parameter="submit"/>

In our JSP, we can refer to the buttons in the usual way


Later, when the user selects a button, the form will pass the submit parameter, along with whatever message is Struts finds for "button.add" or "button.delete" in the resource bundle. In a localized application, this message could vary by the user's selected locale.

Using the conventional DispatchAction, this approach would problematic, since there would have to a Java method named for each message, and not all the messages might valid Java identifiers. This is where the magic of the LookupDispatchAction comes into play.

When you create your LookupDispatchAction subclass, along with the methods for the dispatch operations (see Tip #20) you must also implement a getKeyMethodMap method. This is a "hotspot" that the LookupDispatchAction will call.

Here's an example of the methods you might declare in your subclass:

protected Map getKeyMethodMap(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request) {
  Map map = new HashMap();
  map.put("button.add", "add");
  map.put("button.delete", "delete");
  return map;
}

public ActionForward add(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
  throws IOException, ServletException {
  // do add
  return mapping.findForward("success");
}

public ActionForward delete(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
  // do delete
  return mapping.findForward("success");
}

Internally, the base action will lookup the messages for button.add and button.delete, and match those against the submit parameter. When it finds a match, it will then use either "add" or "delete" to call the corresponding methods.

So while the LookupDispatchAction means adding an extra method to your Action, it lets you skip putting a JavaScript in your form.

Both the DispatchAction and LookupDispatchAction are an excellent way to streamline your Struts action classes, and group several related operations into a single umbrella action.

So, how many dispatch actions do you need? Can you use a dispatch action to collect everything into a single action?

Most often not. In practice, you can easily use one dispatch action for any forms that share a common validation. Sharing a dispatch action between different form beans, or form beans that are validated differently, can start to make things harder rather than simpler. But the use of a dispatch action can easily half or quarter the number of action classes in most Struts application.

HTH, Ted.

Credits. The LookupDispatchAction was originated by Erik Hatcher, one of Struts many volunteer contributors. The examples used in this tip relied heavily on Erik's documentation. (Yeah reuse! Yeah JavaDocs!)

- 作者: snowyvalley 2005年11月30日, 星期三 16:42  回复(0) |  引用(0) 加入博采

Hibernate in Action 翻译计划
第一章 理解O/R持久性(30 Pages)
第二章 介绍和集成Hibernate(30 Pages)
05年11月份完成
第三章 映射持久的类(55 Pages)
05年12月份完成
第四章 使用持久对象(40 Pages)
06年1月
第五章 事务,并发和缓存(40 Pages)
06年2月
第六章 映射的高级内容(45 Pages)
第七章 高效的查找对象(53 Pages)
06年3月
第八章 建立Hibernate应用程序(55 Pages)
06年4月
第九章 Hibernate工具的使用(30 Pages)
附录A Sql基础(4 Pages)
附录B ORM实现策略(6 Pages)
附录C Hibernate 的实际应用(7 Pages)
参照和索引(略)
06年5月

- 作者: snowyvalley 2005年11月4日, 星期五 12:54  回复(0) |  引用(0) 加入博采