TeamSpace
Quality vs. quantity Microphone
Home Who We Are What We Do What We've Done Why Work For Us Blog Contact Us

My Managed Bean Conundrum - Part 1

Bob Laing - April 19 2013 10:00:00 AM


I attended Connect 2013 a few months ago and the first session I sat in on was Russ Maher's Jumpstart:  JMP402 Master Class: Managed Beans and XPages: Your Time is Now.  Excellent session.  And I'll acknowledge up front and probably a few more times that I used code from Russ' sample database in this blog post.

One of the messages in Russ' Jumpstart session was that Managed Beans provide several benefits in an XPages application (performance is one) and Java is the direction that IBM is heading with Domino/XPages so no better time than now to start writing Managed Beans.

With the post Connect/Lotusphere buzz still ringing in my head, once I got back to the real world of work I decided to try to build a Managed Bean into one of the applications that I'm currently working on.  As I've blogged about before (http://www.teamspace.ca/TeamSpace/Blog.nsf/dx/populate-xpage-combobox-choices-from-notes-multi-value-field.htm), one of the common actions that I use in many databases is to grab a value from a configuration document and populate some type of control such as a combobox or listbox.  The blog post I made previously used SSJS to accomplish that, which works well and is relatively portable in that it can be plugged into other databases without much (or any) tweaking of code.  So I set out to recreate that same functionality in a Managed Bean - and I was successful, however upon doing some further reading on Managed Beans now I wonder if I've actually created a bean, but more on that in a bit.

As I mentioned previously, Russ Maher provided excellent sample code with his Connect 2013 session and I used his SystemUtils bean verbatim.  It worked as it was supposed to and provided a jumpstart for me.  The slides from Russ' session can be found here:  http://www.slideshare.net/RussellMaher/jmp402 and the sample code and database can be found here:  http://www.rgmconsulting.com/TheCode.  Both the slides and sample code are provided with Russ' permission.

I started by loading Russ' SystemUtils bean into the database.  To accomplish this, from Designer under Code and then Java I clicked New Java Class and received this dialog box:

Image:My Managed Bean Conundrum - Part 1

I entered com.teamspace.ca for the Package and SystemUtils for the name.  The package is used to group Java classes and should be all lowercase.  You should put whatever is appropriate as a package name, although you can use com.teamspace.ca if you wish.  The name will be the name of the Java Class and should be descriptive of what the bundle of code does and also start with an uppercase letter.  Clicking finish will present an empty Java Class.  From this point I copied the contents of Russ's SystemUtils bean into the empty shell I just created and then saved.

The next step to make this bean available to the the application is to update the faces-config.xml file.  This file is found under Package Explorer, the WebContent folder and then the WEB-INF folder as in the following screen shot:

Image:My Managed Bean Conundrum - Part 1

Edit this file by double-clicking on it, and I added the following lines to the file:

Image:My Managed Bean Conundrum - Part 1

The entry identifies that managed bean information will follow.  The entry provides a name to reference the bean in your XPage or Custom Control.  The is a combination of the package and class name that you entered when creating the bean and the entry identifies the scope of the bean - in this case the bean will last the life of the session.

Save and close this file and that's all that I did to get Russ's SystemUtils bean to work.  This bean contains numerous utility classes to get objects such as the current database, a document given UNID, or a NotesSession.  There is nothing specific to the application in this bean, but many classes that return common objects that any Domino developer will use when building an application.

Check back Monday for part 2 in this blog post where I post code that will look up and return a value from a document that is not a data source on the XPage.
Comments

1Russell Maher  4/19/2013 12:05:45 PM  My Managed Bean Conundrum - Part 1

Excellent! Some of my code actually worked!!

Thanks for the kudos and will be back on Monday see the next post.

2Steve Zavocki  4/22/2013 12:14:48 PM  My Managed Bean Conundrum - Part 1

Good post!

Recently IBM posted the video to Russ' presentation at this link: { Link }

This is great for those of us, unable to make it in person. I have a new project that is perfect for the use of managed beans, thanks to Russ for sharing this info with us.

3generic  10/30/2014 7:12:00 PM  cheap generic viagra

Hello!

<a href="{ Link } online pharmacy</a> , <a href="{ Link } generic viagra</a> , <a href="{ Link } generic cialis</a> ,

4cialis  4/14/2015 4:39:49 PM  generic cialis guaranteed lowest price

Hello!

<a href="{ Link } cialis guaranteed lowest price</a> ,

5cialis  4/15/2015 7:13:25 PM  cialis

Hello!

<a href="{ Link } , <a href="{ Link } ,

6cialis  4/18/2015 12:46:31 AM  buy cialis online 20mg

Hello!

<a href="{ Link } cialis online 20mg</a> , <a href="{ Link } cialis online 20mg</a> ,

7cialis  4/18/2015 4:25:08 AM  cialis

Hello!

<a href="{ Link } ,

8cialis  4/18/2015 4:16:22 PM  cialis

Hello!

<a href="{ Link } ,

9cialis  4/18/2015 5:20:01 PM  cialis

Hello!

<a href="{ Link } ,

10cialis  4/18/2015 8:24:07 PM  cialis

Hello!

<a href="{ Link } ,

11cialis  4/19/2015 12:27:56 AM  cialis

Hello!

<a href="{ Link } ,

12cialis  4/19/2015 12:33:20 AM  cialis

Hello!

<a href="{ Link } ,

13cialis  4/19/2015 12:33:21 AM  cialis

Hello!

<a href="{ Link } ,

14cialis  4/19/2015 8:01:46 AM  cialis

Hello!

<a href="{ Link } ,

15cialis  4/19/2015 2:11:17 PM  cheap cialis online

Hello!

<a href="{ Link } cialis online</a> ,

16cialis  4/20/2015 5:59:34 AM  cheap cialis online

Hello!

<a href="{ Link } cialis online</a> ,

17online  4/22/2015 8:59:11 PM  cialis online pharmacy

Hello!

<a href="{ Link } viagra</a> , <a href="{ Link } online pharmacy</a> ,

18cialis_canada  4/25/2015 1:48:15 AM  cialis canada

Hello!

<a href="{ Link } canada</a> , <a href="{ Link } canada</a> ,

19burada  4/26/2015 9:30:52 PM  burada

Hello!

<a href="{ Link } viagra tablets</a> , <a href="{ Link } ,

20online  4/27/2015 6:56:20 AM  viagra online pharmacy

Hello!

<a href="{ Link } online pharmacy</a> , <a href="{ Link } pills</a> ,

21purchase_cialis  4/27/2015 9:30:15 AM  purchase cialis

Hello!

<a href="{ Link } viagra</a> , <a href="{ Link } cialis</a> ,

22buy_viagra  4/27/2015 8:54:28 PM  buy viagra

Hello!

<a href="{ Link } viagra</a> , <a href="{ Link } discount cialis online</a> ,

23prescription  4/27/2015 11:20:47 PM  cialis prescription required

Hello!

<a href="{ Link } viagra</a> , <a href="{ Link } prescription required</a> ,

24cialis  4/28/2015 3:34:31 PM  cialis

Hello!

<a href="{ Link } , <a href="{ Link } , <a href="{ Link } ,

25cialis  4/29/2015 12:01:52 AM  cialis

Hello!

<a href="{ Link } , <a href="{ Link } , <a href="{ Link } ,

26discount_viagra  5/1/2015 3:38:02 PM  discount viagra

Hello!

{ Link } , , { Link } , ,

27cialis  5/6/2015 12:25:28 PM  cheapest cialis price

Hello!

{ Link } , , { Link } , ,

28viagra_dosage  5/6/2015 2:16:22 PM  viagra dosage

Hello!

{ Link } , , { Link } , ,

29viagra_pharmacy  5/7/2015 1:15:52 PM  viagra pharmacy

Hello!

{ Link } , , { Link } , ,

30cialis  5/7/2015 2:04:42 PM  cheap cialis site

Hello!

{ Link } , , { Link } , ,

31cialis_online  5/8/2015 2:45:25 AM  cialis online

Hello!

{ Link } , , { Link } , ,

32cialis_pills  5/8/2015 9:08:32 PM  cialis pills

Hello!

{ Link } , , { Link } , ,

33canadian_cialis  5/13/2015 9:21:56 PM  canadian cialis

{ Link } , { Link } ,

34viagra_price  5/15/2015 1:29:27 PM  viagra price

{ Link } , { Link } ,

35of  5/16/2015 8:56:56 AM  pills of cialis

{ Link } , { Link } ,

36generic_cialis  5/18/2015 7:39:04 AM  generic cialis

Hello!

{ Link } , , { Link } , ,

37generic_cialis  5/18/2015 5:31:17 PM  generic cialis

Hello!

{ Link } , , { Link } , ,

38cialis_online  6/4/2015 6:33:36 AM  cialis online

{ Link } , { Link } ,

39for  6/4/2015 10:37:37 PM  My Managed Bean Conundrum - Part 1

{ Link } , { Link } ,

40purchase_viagra  6/5/2015 2:48:26 AM  My Managed Bean Conundrum - Part 1

{ Link } , { Link } ,

41bo  6/19/2015 7:49:53 AM  cialis bo script

{ Link } , { Link } ,

42viagra  6/21/2015 8:25:07 AM  generic viagra sildenafil

{ Link } , { Link } ,

43generic_viagra  7/6/2015 6:21:43 PM  generic viagra

{ Link } , { Link } ,

44fast  7/8/2015 4:12:57 PM  cialis fast delivery

{ Link } , { Link } ,

45viagra_reviews  7/9/2015 7:02:55 PM  viagra reviews

{ Link } , { Link } ,

46online  7/10/2015 8:36:27 AM  cialis online pharmacy

{ Link } , { Link } ,

47cheap_viagra  7/15/2015 6:43:21 PM  cheap viagra

{ Link } , { Link } ,

48viagra  7/17/2015 12:46:27 PM  viagra

{ Link } , cialis ,

49delivery  7/17/2015 11:24:06 PM  fast delivery cialis

{ Link } , cialis ,

50fast  7/18/2015 1:56:26 PM  viagra fast delivery

{ Link } , cialis ,

51viagra  7/24/2015 6:12:26 PM  http://buygenericviagra7now.com/

Hello!

{ Link } , , { Link } , ,

52cialis  7/28/2015 5:13:34 PM  cialis

{ Link } , { Link } ,

53viagra  8/3/2015 6:18:31 PM  viagra

{ Link } , { Link } ,

54fast  8/11/2015 3:48:50 PM  cialis fast delivery

{ Link } , { Link } ,

55viagra_price  8/21/2015 8:57:12 AM  viagra price

{ Link } , { Link } ,

56cialis  8/21/2015 1:05:26 PM  cialis

{ Link } , { Link } ,

57viagra  8/21/2015 5:07:32 PM  viagra

{ Link } , { Link } ,

58viagra_price  8/21/2015 9:11:04 PM  viagra price

{ Link } , { Link } ,

59cialis  8/22/2015 1:01:53 AM  cialis

{ Link } , { Link } ,

60cialis  8/22/2015 9:10:36 AM  cialis

{ Link } , { Link } ,

61order_cialis  8/29/2015 2:34:31 AM  order cialis

{ Link } , { Link } ,

62cialis  9/12/2015 3:25:55 PM  buy cialis cheap prices fast delivery

Hello!

{ Link } , , { Link } , ,

63cialis_professional  9/23/2015 5:38:17 PM  cialis professional

{ Link } , { Link } ,

64buy_viagra  9/26/2015 4:32:55 AM  buy viagra

{ Link } , { Link } ,

65online  10/1/2015 2:33:37 AM  cialis online pharmacy

{ Link } , { Link } ,

66canadian_viagra  10/7/2015 3:30:57 PM  canadian viagra

{ Link } , { Link } ,

67canadian_viagra  10/8/2015 7:26:13 AM  canadian viagra

{ Link } , { Link } ,

68viagra_professional  10/13/2015 3:56:11 PM  viagra professional

{ Link } , { Link } ,

69super  10/14/2015 4:53:58 AM  viagra super active

{ Link } , { Link } ,

70generic_viagra  10/15/2015 5:43:11 AM  generic viagra

Hello!

{ Link } , , { Link } , ,

71sildenafil  10/15/2015 1:32:06 PM  sildenafil

Hello!

{ Link } , , { Link } , ,

72cialis_canada  10/20/2015 7:20:26 AM  cialis canada

{ Link } , { Link } ,

73cialis_canada  10/20/2015 10:22:42 PM  cialis canada

{ Link } , { Link } ,

74cialis  10/29/2015 4:15:08 PM  order cialis online not fakeorder quality cialis

Hello!

{ Link } , , { Link } , ,

75viagra  10/30/2015 3:36:01 AM  order viagra online

Hello!

{ Link } , , { Link } , ,

76prescription  11/7/2015 4:51:36 PM  non prescription cialis pills

{ Link } , { Link } ,

77generic  11/11/2015 10:14:07 AM  cialis generic soft

{ Link } , { Link } ,

78viagra  11/13/2015 12:31:43 PM  cheap viagra tablets

{ Link } , { Link } ,

79price  11/17/2015 1:18:51 PM  best price viagra

{ Link } , { Link } ,

80cialis  11/18/2015 12:34:46 PM  best cialis price

Hello!

{ Link } , , { Link } , , { Link } , ,

81by  11/25/2015 3:03:34 PM  buy by cialis money order

{ Link } , { Link } ,

82viagra  12/24/2015 8:28:11 AM  buy viagra cheap

Hello!

{ Link } , , { Link } , ,

83viagra  12/24/2015 5:03:36 PM  buy viagra canada online without script

Hello!

{ Link } , , { Link } , ,

84cialis  12/25/2015 12:39:58 AM  buy cialis cheap

Hello!

{ Link } , , { Link } , ,

85cialis  12/25/2015 8:18:46 AM  buy cialis online without script canada

Hello!

{ Link } , , { Link } , ,

86without  1/16/2017 5:04:38 PM  viagra without a doctor prescription

Hello!

{ Link } , , { Link } , , , , { Link } , ,

87irovel  2/7/2017 9:50:10 PM  http://www.irov2online.com/

Hello!

{ Link } , , { Link } , ,