当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Chapter 4. Creating a Stateful
 

 

    摘要: he riddle of 10 candles: if there are 10 candles and 3 were blown out, how many are left? this semantic puzzle, which appeared on a javaworld.com/javaworld/jw-05-2005/jw-0523-anniversary.html#resourc......
    摘要: 如何构造使用自定义的classloader既然自定义的classloader,能解决上述问题,那接下去看看,我们如何来使用自定义的classloader。结合本文种的原码---(在differentversionspush的目录里),有个filesystemclassloader,类图描述如下:图9. 看看他的方法 findclassbytes(string classname); publi......


Tutorial for building J2EE Applications using JBOSS and ECLIPSE(4)

chapter 4.

creating a stateful session bean 【程序编程相关:基于J2EE的开发的一些经验

【推荐阅读:J2me开发心得-数组的使用

well try something a little less ambitious for the time being! this bean is similar to the storeaccess bean created in the previous chapter except that it will store the userid of the client, after authentication is successful. 【扩展信息:Java语言编码规范(Java Code

this chapter covers how to create a stateful session ejb component. unlike stateless beans, stateful bean instances are associated with a particular client session and can therefore maintain information useful during the lifetime of that session. a classic and familiar example of this in a web e-commerce context is that of a shopping cart.

note : this bean will not be used further in tutorial, as this chapter demonstrates how stateful beans are created.

tasks :

create a stateful session bean named storeaccessstate.

add a business method in the bean named loginuser with the signature

public string loginuser (string username, string password)

add a call back method ejbcreate with the signature

public void ejbcreate (string userid)

generate the dao interface.

access the dao named storeaccesdaoimpl under package au.com.tusc.dao, created and implemented in the previous chapter. this dao has a method named loginuser, called by loginuser in the bean with the signature

public string loginuser (string username, string password)

deploy the storeaccessstate bean.

create your test client named sessionstateclient under package au.com.tusc.client.

run your client and test the bean.

create stateless bean :

go to package explorer > expand mystore (project) node > select src, right click and a menu will pop up.

on pop up menu > new > lomboz ejb creation wizard.

enter the package name au.com.tusc.sessionstate, bean name storeaccessstate and select bean type as stateful > finish.

this will create package named au.com.tusc.sessionstate under src and storeaccessstatebean under that package as shown below.


...   下一页
 ·java规则——中级篇    »显示摘要«
    摘要: 本文介绍的java规则的说明分为3个主要级别,中级是平时开发用的比较多的级别,在今后将陆续写出其他的规则。遵守了这些规则可以提高程序的效率、使代码又更好的可读性等。(1) 在finally方法里关掉input或者output 资源再方法体里面定义了input或者output流的话,需要在finally里面把它关掉。以下这几种调用不需要遵守这条规则,因为colse()方法不起作用:)java.io......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE