Quantcast
Channel: Java – NotesIn9

NotesIn9 054: Intro To Java for XPages Developers – Part 3

$
0
0

In this show Jeremy Hodge comes back to continue his ongoing series on helping XPages Developers get started with Java.

If you like this video, please give it a rating for the Lotus VideoFest event.

Thanks!


NotesIn9 076: What are Java Beans?

$
0
0

In this show I attempt to tackle the “forbidden topic”. Yep. Java. Me talk about Java. It’s unexpected. I know. This show is an expanded version of parts of a presentation that I did at MWLug.

I first talk about some of the tools available to the XPages developer and when you might want or not want to use some.

Then I get into the meat of the show – Java Beans. I try and explain exactly what they are and show what they look like. I talk about managed and “unmanaged” beans and go through what they look like and a little bit on how they can be used.

This is a “getting to know them” type show. Not an indepth getting started on building them. I didn’t intend to do this show quite yet but I’m getting some great contributions as part of the Drive to 99 Event that are starting to talk about Java beans so I wanted to get this little intro out.

There’s lots more Java Beans stuff coming. If you can’t wait Jeremy Hodge did 3 shows for NotesIn9 that are highly recommended. I’ll probably be doing my attempt and an indepth intro to Java in the near future as well.

If you have any questions please ask.

P.S. This show is about 36 minutes and I got it in 1 take! BOO YAY!! :-)

NotesIn9 84: Sharing Managed Beans in XPages

$
0
0

This show is the first part in a 3 part series from another new contributor to NotesIn9.  I’m very excited to bring onto the show Russ Maher who is an excellent XPages developer and speaker.  Russ is going to show us how you can use Managed beans to solve a business problem in XPages.

Since this show is once again talking about Java I mention some resources on getting started with the Java Language, especially in learning the syntax. I’ve used the Head First Java book and liked it very much but recently I found a great new website designed to teach the Java Language.

http://howtoprogramwithjava.com

This site is run by Trevor Page.  I think it absolutely rocks.  It’s has great getting started with Java information that’s very well written in an easy to follow manner. Trvor also does a Podcast and has produced a really good ebook on the subject.  I highly recommend checking his site out for anyone who’s starting to learn Java.

He also has a site specifically setup for his Java ebook here:  http://javapdf.org You can download a sample and check it out. I bought it as soon as it came out and it’s really well done.

There’s lots more Java XPages material coming to NotesIn9 as well as non Java shows.  Remember, as Paul Calhoun likes to say, “Java is just a tool in your XPages toolbox”. I think it’s a really good tool to have.

UPDATE: DEMO FILE for the show

NotesIn9 085: Sharing Managed Beans in XPages Part 2

$
0
0

In this show Russ Maher comes back on with the 2nd part his 3 part series on creating and working with Java managed Beans in XPages.  While the purpose of this episode is to share data between multiple beans, and it’s not a pure “getting started with beans”, there’s a lot of good beginner information in here on how you can use beans and Russ also does a really good discussion on Java Maps. I like that he even talks about this code:

FacesContext.getCurrentInstance().getExternalContext().getSessionMap.get(key)

and describes what each piece really means.  Russ will also introduce the concept of variable resolver which seems to be very popular with the advanced XPages developers.

This content should not be missed for an XPages Developer.

Click here for Part 1

Click here for Part 3

Click here for Demo File

NotesIn9 86: Sharing Managed Beans in XPages Part 3

$
0
0

In this show Russ Maher concludes his three part series on sharing Bean data inside your XPages applicaton.  In today’s show he’ll talk about using Managed Properties.

Over the course of this series Russ has taught us a lot about Beans, Java, XPages/JSF concepts like variable resolvers and now Managed Properties for Beans.

I want to thank Russ very much for contributing all this great material to NotesIn9. I really appreciate it and I’m sure others have as well.

UPDATE: DEMO FILE for the show

Part 1

Part 2

NotesIn9 93: Introduction to DOTS

$
0
0

In this episode I welcome Serdar Besegmez, an IBM Champion and new contributor to the show. Serdar will come on to talk about DOTS. DOTS is way for you to create your own server tasks. Very fast and very powerful.

While this topic is a little more on the advanced scale, I think Serdar has done an excellent job of walking through the concepts of DOTS and then showing how to setup your development environment and finally how to run it on the server. He highlights additional resources such as a Show-&-Tell from Lotusphere2012 and even shows a key tip on outputting messages to the console.

I hope you like it.

NotesIn9 106: Intro to Java Controller Classes

$
0
0

In this show Jesse Gallagher, a great new contribitor, comes on to give us an over view of using Java Controller Classes to help seperate your business logic from your XPage.  By moving your logic outside of the XPage you get much cleaner XML source for your XPage.

If you’re new to the thought of using Java inside XPages, I’d suggest don’t focus on the actual syntax that Jesse’s using here but the overall concepts.  This is very similar to using Lotusscript custom classes to hold your business logic so you have cleaner agents and view buttons.

Hope you like it.

NotesIn9 114: Using Wrappers with XPages

$
0
0

In this show yet another NEW contributor comes on to share content with the community.  Today, Stephan Wissel, IBMer and blogger at wissel.net comes on the show for a discussion on a programming design pattern called “Facade” and how you might want to use this in your XPages development.


NotesIn9 116: Data Contexts and Variable Resolvers

$
0
0

In this show Paul Withers returns to enlighten us on what Data Contexts and Variable Resolvers are and how to use them in XPages.

 

In addition I want to send out some Happy Birthday wishes to:

Bruce Elgort and Mikkel Heisterberg and also a belated Happy Birthday Paul Withers himself!

NotesIn9 118:Using Java to Sign a Database in XPages

$
0
0

In this show John Jardin comes back on with an interesting demo on how to Sign a nsf AS THE SERVER from an XPage.  John will create a very small custom Java Class that he uses as a Managed Bean.  A really good demo.

NotesIn9 122: Working with Java Objects in XPages

$
0
0

This show comes directly from my day job.  This is a presentation that I gave to the internal XPages team. I talk about using Java Objects but not necessarily via “Managed Beans”.

A lot of XPages and Java talk centers around “Managed Beans” but that’s not your only option.  There are additional ways to use Java Code in your XPages Applications that don’t need Managed Beans.  There’s also DataContext, objectData and “ScopedBinding”.  NOTE: “ScopedBinding” is a term I’m making up myself.

So I’m really not an expert here, this is just stuff I’ve been playing with and there might be things I’ve missed but this is a simple demo on how to use a Java Class from each of these entry points. I thought it might be useful especially if you hear the term “Java Managed Bean” and think it’s something scary.

Another Note:  I have a little Java Class in here for the demo.  That Class itself was rushed and not exactly an example of best practice.  It’s kinda close, but I left some crap in there that needs to be cleaned up.

Hope You like the show.

P.S. In the show I am asking for feedback on how you prefer to consume NotesIn9 Videos.  Do you stream from the website? Do you download and watch off line via iTunes/RSS?  Do you prefer YouTube?  Any feedback on that would be appreciated.  I’m trying to find out preferences between downloading vs streaming for the most part. Feel free to comment here, or send me a note on twitter or email.

thanks!

UPDATE: I mentioned on the video that there were several things that I did not know.  Most of them have been answered by the great Tim Tripcony who sent me the information below.

 

UPDATE 2: Here is the demo file for this show

beans.zip

Comments from Tim Tripcony:

 

Great video today! I’m hoping I can answer some of the questions you brought up during the demo:

1. Java “purists” would tell you that if your class has A) an argumentless constructor, B) properties exposed via getters and setters, and C) implements Serializable, it’s a bean. With “managed beans”, all that is being “managed” is the variable name and scope. So the class you showed is always a bean, regardless of each of the ways you demo’ed using it, because its own code meets the bean criteria. But you also registered it in faces-config, so Domino “manages” making sure there’s always an instance of that bean named “PersonBean” in the session scope. That’s what makes it managed. It was already a bean because it uses bean conventions (serializable, argumentless constructor, and getters/setters).

2. ignoreRequestParams is ideal for “related” data sources. For instance, if you had an XPages-based blog, and you’re using the standard document data source for blog entries, then you’d want that data source to respect the URL, because then you can use built-in URL parameters like action, documentId, formName, and databaseName, and it’ll know which document to open, whether it’s new, in edit mode or read mode, etc. In contrast, if you had a repeat underneath the entry content to display comments, then your data source for each comment in the repeat *should* set ignoreRequestParams to true. Otherwise, even if you’ve set action to “openDocument” and calculating the documentId based on what row the repeat is rendering, the data will IGNORE those properties, because it will see matching URL parameters and the value of those parameters will override the data source properties. BUT… all of this behavior is the way that the original data sources (document and view) behave. The object data source always ignores the URL, so ignoreRequestParams has no effect, because it always ignores the params. The property just shows up because it’s part of the base interface for all data sources.

3. requestParamPrefix is ideal for “sibling” data sources. What I mean by that is if you have two data sources on a page that are sort of “peers” (as opposed to a parent-response, discussion thread style relationship). For example, suppose you had two documents that you wanted to allow the user to compare side-by-side… if you created one document data source with standard attributes (just var and formName), and a second document data source where requestParamPrefix=”other”, then your URL query string could contain something like documentId=”OU812″&otherdocumentId=”OU813″… So your first data source will be bound to the document whose note ID is OU812, and your second data source will be bound to the document whose note ID is OU813. Object data sources also ignore this property; this only affects document and view data sources.

4. The reason you had to set your data context to compute on page load is because data contexts are automatically associated with the request scope… so if you set it to compute dynamically, then it will create a new one on each request, not just one for each page instance (i.e. view scope). Setting it to compute on page load makes it behave more like a data source than a data context.

5. Your assumption about the syntax of #{sessionScope.ScopeBean.firstName} is correct. All 4 of the scopes are Maps, so when the variable resolver identifies sessionScope as a Map, then the property resolver knows that instead of the usual getPropertyName() / setPropertyName(newValue) syntax, it should call get(“propertyName”) and put(“propertyName”, newValue) instead… but only if it’s the last property in the chain — anything in the middle is always treated as a get. So the whole expression essentially gets translated into sessionScope.get(“ScopeBean”).getFirstName() in read operations, and sessionScope.get(“ScopeBean”).setFirstName() in write operations.

 

NotesIn9 127: XPages Parallel Processing

$
0
0

In this show Serdar Basegmez returns with a demo taken from his recent presentation at Icon UK.

He’ll introduce the concept of creating a new thread in your XPages application that can be used for longer running processes.  This effectively lets you do 2 things at once in your application.

 

You can download a demo database here:  https://github.com/sbasegmez/ICONUK2013

NotesIn9 132: Using Java in XPages Part 1

$
0
0

Ok.  There’s a lot going on in this show so let’s get started:

This show came from a Skype Chat I had with Tim Tripcony.  The goal here is a series that focuses on how you actually use xpages and java beans together.  We want to show how to bind to Java Objects instead of documents and actually use them.  This is not a full “app” but more of a CRUD example.  We didn’t want to distract too much from the core concept of linking XPages to Java Beans directly.

Of course I failed at that as since Tim was using source control for this I wanted to start the show with source control.  So you can see me bring the project down and create not only the .ntf but also the .nsf file.  So if that’s not too interesting to you skip it.  the Java stuff starts around the 15 minute mark I think.

I did do some editing to cut out some other parts that weren’t needed.  So there’s a pretty poor transition in there at one point. One of the things I cut out was how Tim was using Themes to pull Bootstap 3 into his app from a CDN.  So if you’re interested in Bootstrap you might want to download the app and check that out!  Clever.  Beats putting it into the NSF.

Today is actually my birthday.  So as a gift to the community I wanted to get this show out and start this series.  Jesse Gallagher asked if that I was doing a Hobbit Style Birthday.  Where a Hobbit gives out gifts on their birthday.  Wish I would have thought of it that way.  Typical Jesse – usually 3 steps ahead of me.

Anyway – I hope you like the show.

P.S. This show is at another new resolution. 1440×900 I believe.  I’m having trouble getting my  Parallels VM to use my normal 1280×720 resolution.  It works great for my work VM but not my NotesIn9 VM.  Really weird.  I do like the bigger resolution since you know…  it’s Designer and all that.  So I might try to keep this.  I don’t know.  But PLEASE let me know if you have problems viewing the show or reading any code.

NotesIn9 133: Using Java in XPages Part 2

$
0
0

In this show, Tim Tripcony expounds on the last episode where I did a very basic CRUD example that’s based on Java binding rather then document binding.

I had mentioned one of the problems with building the java classes was that I would create getters and setters for each field. Tim’s going to show how you can build your code to avoid that. He also improves the CRUD example with a little BootStrap Magic!

Tim will return for Part 3 tomorrow!!

NotesIn9 134: Using Java with XPages Part 3

$
0
0

In this show Tim Tripcony continues his series of exploring the use of Java with your XPages application.  Today’s show discusses linking buttons to Java, dealing with ReadOnly properties and how to deal with explilcit getters and setters – but only when you want to!

There’s even a little more Bootstrap goodness in here!


NotesIn9 135: Using Java in XPages Part4

$
0
0

Tim Tripcony returns again for another great show in his Java series.  Today he’ll be introducing the concept of a “MimeBean”.  A “MimeBean” gives the ability to save Java Objects inside a notes field.  It opens up many new possibilities for storing data in your applications.

Not to be missed!

NotesIn9 138: XPages Combobox ImprovementsJ

$
0
0

In this show I take a look at using a Combobox inside XPages.  I’m going to demo how to use Java – but it’s NOT scary Java – I show you everything.

We’re going to show the user a pretty value in the combobox but get a hold of and store the key value for our use.

I’m also going to show how you can create categories inside the combobox. That’s kinda cool I think depending on your situation.

Update:

Oliver Busse – @zeromancer1972 – has another example of this on his blog.  http://mardou.dyndns.org/Privat/osnippets.nsf/id/OBUE-9C5KDN

In that post he’s reading the data in from a view.  Cool!

 

Update 2:

Ove Stoerholt just did a blog post on comboboxes.  He discusses one “Gotcha” that you need to avoid.  A really good post!

 

NotesIn9 141: Java vs JavaScript Throwdown

$
0
0

This is a VERY DIFFERENT NotesIn9.  It’s less of a normal show and more if a response to a recent blog post regarding one persons opinion on the value of Java in XPages and the Value of the UI vs the backend. Actually this show is more of a really long “rant”.

This show could absolutely suck.  I pretty much broke all my rules and tried to have fun with it.  I do give my thoughts on things so maybe there’s at least a little value there.

There’s no Demo.  There is only the trainwreck.

I would say that if you do give it a shot.  Stick around for the end. That’s when I get my most immature.  For the first time ever there’s even a few bloopers at the very end.  No not me, but one of the cast members.

I want to thank Mark Roden for the original post.  Please check out the comments.  There’s a lot of good information in there.  Here’s the shortlink:

http://xpag.es/?WTF

I hope you like it.

NotesIn9 144: OAuth for Domino Walkthrough

$
0
0

In this show Tim Tripcony explains how to get your Domino server to PROVIDE OAuth credentials and services.

#codefortim

 

 

Note: This show is a odd resolution because Tim sent me his demo at a bigger size then normal.  Because of this I’m not sure if it will play on mobile devices.

 

 

NotesIn9 152: JSON and Java

$
0
0

In this show Frank van der Linden, another brand new contributor comes on to give us a little demo of using JSON and JAVA in XPages.  If you look closely you might even see a little Connections going on.

NotesIn9 153: Java based Debug Control Part 1

$
0
0

In this show Greg Reeder, XPage developer and new contributor joins the show to talk some Java and how you might be able to use it to build a logging control for errors and messages.

This is the first of a 3 part series from Greg which I’m publishing all at once due to the length and complexity of the information.

NotesIn9 154: Java based Debug Control Part 2

$
0
0

In this show Greg Reeder, XPage developer returns for part 2 of his series to talk some Java programming and how you might be able to use it to build a logging control for errors and messages.

This is the second of a 3 part series from Greg which I’m publishing all at once due to the length and complexity of the information.


NotesIn9 155: Java based Debug Control Part 3

$
0
0

In this show Greg Reeder, XPage developer returns for part 2 of his series to talk some Java programming and how you might be able to use it to build a logging control for errors and messages.

This is the third of a 3 part series from Greg which I’m publishing all at once due to the length and complexity of the information.

NotesIn9 156: Introduction to Custom Renderers in XPages

$
0
0

In this show, Jesse Gallagher officially starts the NotesIn9 Hackathon with a great introduction on “custom renderers” in XPages.  While this seems to be a really scary topic, Jesse explains it in a way that even I can grasp it.

 

NotesIn9 158: Intro to the Frostillicus Framework

$
0
0

In this show Jesse Gallagher returns to give us an introduction to this amazing Framework he’s created to try and improve the XPages coding experience.

I can’t say that I totally “get it” yet BUT it looks VERY interesting. I have so far taken the “controller” piece from the framework and I’m successfully using that in my applications and I’ll be featuring that on NotesIn9 very soon. It’s really improved how I create my applications.

NotesIn9 160: Learning XPages Part 1 – Installing Designer

$
0
0

This show beings my great experiment. I’ve wanted to do this for a couple of years actually. I’m going to ATTEMPT to start from scratch and build an XPages Application.

I’m going to assume that the viewer has little to no knowledge of Domino Development.  I’ve gotten a bunch of emails from people brand new to the platform so the beginning shows are kinda geared for them. I’m really trying to start from square one.

When I get into the Application build – which won’t be till the 5th show I believe, I’m going to TRY and build a “typical” XPages application – Companies, contacts, Activities… stuff like that.  But when I do get into the App build, It’s going to be built with a heavy preference for Java and Managed Beans. Why? Must I use Java to build this kind of application?  Absolutely not.  No Java needed.  But I’m going to use it for 2 reasons:

1-People have been asking for this kind of information

2-This is how I might build an app in the day job so that’s what I’m going to do here.

So that’s why I’m using Java.  It will also let me get into making a “business api” I hope.

I’m also going to use Bootstrap and the OpenNTF API.  Basically any tool in the toolbox.

That’s the plan anyway.

 

P.S. In this show I meant to start with actually installing the designer software, but messed something up and didn’t want to redo it.  I figure clicking on the installer isn’t that big a deal.  So this show starts off after the initial install.

P.P.S If you’re a beginner and want further information and an alternate view point on starting XPages development, you might want to check out a video series from Paul Della-Nebbia on his blog.  

Oh and there is one more thing….

Some episodes MIGHT contain some “bloopers” at the end.

NotesIn9 165: Learning XPages Part 6 – Forms, Views and XPages

$
0
0

In this show we finally start coding.  Horaay!  I’m going to create a form and a couple views to start setting up how the data for the applicaiton will work and then I’ll go right into some Java which will act as a bridge between our application and the data that gets stored into the database itself.

This show should be particularily good if you’re interested in starting to use Java with your XPages applications.

Note: This episode was filmed a couple weeks ago when I was watching the Philadaphila Eagles beat up on the New York Giants. The Eagles won 27 – 0!  It was a good night.  :)

NotesIn9 166: Learning XPages Part 7 – Company Controller

$
0
0

In this show I demonstrate how to setup and set using a Java “Page Controller”.  This is a technique that Jesse Gallagher came up with and I absolutely love.  Without a doubt it saved me a TON of work on a recent day job assignment.  There’s a little effort involved in setting it up but it’s so worth it in the long run.

 

 

NotesIn9 167: Learning XPages Part 8 – Working towards CRUD

$
0
0

In this show I continue on to the goal of CRUD. CRUD stands for Create, Read, Update and Delete. By the end of this show we should be able to achieve all 4 actions against the Company document.

I’ve not done anything to really make this app look pretty yet.  Honestly I’ve given the UI very little thought so far.  I’m trying to just focus on the core functionality at the moment so the UI stuff doesn’t distract.  I do want to better integrate Bootstrap to clean up the UI at some point when it makes sense.

Note: I’ve been pushing a bunch of these shows out quickly. I filmed them a while back in one evening. I believe I have one more small one then I’ll probably take a little break from this series as I have another personal XPages project that must be ready by Thanksgiving.


NotesIn9 172: XPages Java Debugging

$
0
0

In this show XPages “Professor” and IBM Champion, Mr. Paul Withers returns for an in depth look at how to use the Java Debugger to step through the Java code in your XPages applications.  In the beginning and end of the show he’ll also talk about OpenLog which was originally an AMAZING project from Julian Robichaux that Paul has enhanced for the XPages world.

This show finally sees a slightly different format that I’ve been wanting to do for a while. We did this demo via Gotomeeting so I was able to talk to Paul and ask some questions throughout the demo.  I’m hoping this will be a benefit for certain topics and maybe even certain speakers – especially new ones that might not feel comfortable in doing a demo solo.  So really there should be no more excuses. :)

Let me know what you think!

Thanks

Dave

NotesIn9 173: Getting Started with Servlets

$
0
0

This is one of those shows that I think is really important.  

Today we welcome Eric McCormick, a new contributor and IBM Champion, to the show.  Eric did a geat demo showing us how to get started using Java to make Servlets inside our XPages Applications.  This opens a lot of doors to expose your data to applications outside of the Domino server.

Eric’s Blog

Note: This show doesn’t have great audio.  My headset stopped working for some reason and also Eric recorded the show in several takes I think.  I tried to clean up what I could – hopefully it’s not a huge problem.

NotesIn9 182: XPages and Java from Start to Finish

$
0
0

In this show I do an in depth demo of an XPages app that’s based on Java Code. I didn’t take time to build it from scratch in front of you, but I go over every line of code in the app.
The app lets you you Create, Read, Update, and Delete Project documents, and then add to each project an unlimited number of tasks.

It’s a long demo – but I first show the app, then go through all the Java code, and then finally the XPages code itself.

I hope this helps you put the pieces together to consider adding Java to your XPages toolbox.

Note: In the Demo, I do use the OpenNTF Domino API which makes life so much easier. It’s not required and in the near future I will try to produce a “cheatsheet” to help translate from the API to the lotus.domino classes.

 

ni9-182 Demo File.nsf

Notes In 9 : 189 Introduction to SonarQube with a side of Docker

$
0
0

In this show Eric McCormick returns to show us how to use SonarQube and Docker to help us improve our code.

Discussion on using PageControllers in XPages

$
0
0

WARNING:  This is a long one.  Enter if you dare.  

In the XPages Slack chat, which is free for anyone to join, hint hint.  Whenever I see people working together to solve an interesting problem I always try and suggest that someone blog it so the content and solution they’ve worked though gets a bigger audience. I’ll publish it myself if the person doesn’t have a blog. I don’t think I’m always successful but I try.  Anyway today is my turn to try and lead by example. I was typing up a long response to an email and thought – F this… I’ll just blog this for everyone.

Below is an email I got from a NotesIn9 Viewer (and friend) who is having some questions related to episode 182.  In that episode I tried to just do a quick take on how to do CRUD (Create, Read, Update, Delete) operations using Java and XPages.  I think one of the points of confusion was that I was more focused on the Java bits, and didn’t do a great job at hooking into the actual pageController for the “Project” XPage.  I didn’t want to use Jesse Gallagher’s awesome Frostillicus framework and have that dependency.  I ended up using a manual managed bean when I should have used Object Data Source.  I simply never thought of using Object Data for a page controller until I think it was Paul Withers that mentioned it in the Slack Chat.  doh!

Anyway here’s the last email he sent in this thread…

I never did figure out why faces-config was empty whenever I created a new database, but since I’m able to manually create the XML file, I got over it.

I must admit to being confused about how you did the data sources for NotesIn9-182. I see from what you wrote above that I can handle this by either importing Jesse’s framework or by using Object Data. But you indirectly also said that’s not how you did it for NotesIn9-182.

I’m looking at the Project XPage. The XPage doesn’t have a Data Source but computedField1 gets its value via Simple data binding with Data source set to “ProjectControl” and Bind to set to “currentProject.unique.

So how DID you set the value for computedField1? I guess it really doesn’t matter since I need to either use Jesse’s or Object Data, but this does make me curious.

And it turns out that creation order of the design elements seems to matter some, but in a Captain Obvious kind of way. For example, controller.project.java requires both controller.base.java and com.notesin9.tracker.Project and com.notesin9.tracker.Task. to be created first (at least in part) because controller.project uses all of them.

So if in the project page, I want to display the name of the person who created the project.

  • The name of the project creator is the property “creator” of the class “Project”
  • “Project” is imported by the class “project”.
  • “currentProject” is an object declared in the class “project”.
  • In faces-config or in Object Data, methods and properties in the object “project” are referenced by the Data Source name “ProjectControl”.
  • So the value of the computed field that displays the creator used ProjectControl as the data source from which currentProject.creator is retrieved.
  • Wow. As dumbed down as this is, this is still a lot.

Time for me to File.Application.New and reduce it to its bare essentials.

Thanks again for your help.

And my response is :

I think I’ve seen the blank faces-config thing before..  not sure…  I just now created a new database and went in and all it gave me was :

<?xml version="1.0" encoding="UTF-8"?>
<faces-config/>

Is that what you’re seeing? or is it totally blank?

It used to be more like this by default

<faces-config>
  <!--AUTOGEN-START-BUILDER: Automatically generated by IBM Domino Designer. Do not modify.-->
  <!--AUTOGEN-END-BUILDER: End of automatically generated section-->
</faces-config>

And then you’d add beans like this :

<faces-config>
  <managed-bean>
    <managed-bean-name>ProjectControl</managed-bean-name>
    <managed-bean-class>controller.project</managed-bean-class>
    <managed-bean-scope>view</managed-bean-scope>
  </managed-bean>
  <!--AUTOGEN-START-BUILDER: Automatically generated by IBM Domino Designer. Do not modify.-->
  <!--AUTOGEN-END-BUILDER: End of automatically generated section-->
</faces-config>

interesting…

I might not have full understood the last email.  The order does matter when it comes to Java.  The order of elements for the other stuff doesn’t really matter.  I could link an xpage to a page controller that didn’t yet exist if needed.  The XPage wouldn’t care because it doesn’t know about it from designer itself.

Ok… regarding the Project Page….

for every XPage these days I want to have a Java class acting as a “pageController”.  This lets me put almost all my logic in a nicely coded class and gets it off the XML of the XPage and all that “CDATA” crap.  There are just a lot of benefits to this approach.

In that show I choose to make a viewScoped managed bean in the faces config.  I did this because 1. I didn’t want the frostillicus dependency and 2. Stupidly I didn’t think of using object data.  Object data would have been better to use for the controller.

Because it’s a managed bean… there doesn’t need to be anything defined in the xpage dataSource… That’s what a managed bean is… you define it at faces-config and now it’s available anywhere in the application whenever you call it.  The XPages runtime will create it automatically – which is why managed beans require an empty constructor.  It’s not a bad thing to have managed beans…  and a great example of needing a managed bean might be for a shopping cart object… something that lives in sessionScope… so it has the longer life..  though technically a you could also manually put a cart object in sessionScope from a page Controller..  retrieve it when you want and get the same results…  like everything there’s multiple ways to arrive at the same destination.

So how did computedField1 get it’s value?   Let’s look.  

Here’s what it looks like in the main “pretty pane” : 

figure1

The dataSource is the managed bean.  Which holds a custom object called “currentProject”.  Which has a method to get the unique value.

So this screenshot translates to : 

ProjectControl.getCurrentProject().getUnique().

And that would work if using SSJS.

But you can’t type “ProjectControl” into the dropdown.  That’s annoying and I’ve mentioned that to IBM recently in fact.  So you need to go to the Advanced Tab and choose Expression Language (EL) and just type it in there :

figure2

And in the source it will then render as this : 

<xp:text escape="true" id="computedField1"
value="#{ProjectControl.currentProject.unique}" styleClass="form-control">
</xp:text>

Just a side note – since this value doesn’t change I probably should have set it to Compute on page Load….

Anyway….

Now regarding your bullet lists….

First remember what’s going on here…  We’re trying to get to at least some form of “MVC” which is “Model”, “View”, and “Controller”…  And honestly I don’t know all the technical purist definitions of this so here’s how I like to think of it when I work.

VIEW: The XPage is to display information to the user.  I guess this is the “View” but I’m not sure.  It’s responsible the UI and everything you display.  BUT ideally it’s NOT responsible for anything that requires “logic”. No heavy lifting. And it doesn’t talk directly to the data itself.  No binding to documents or views. (Of course there might be exceptions)  All that belongs in the “Controller”.  So ideally the XPage only talks to the Controller.

CONTROLLER: The controller is just a java class to hold any logic that the XPage needs and is also the gatekeeper between the xpage and the actual data. Any logic to show or hide content belongs here.  All this controller really is, at it’s core, is a viewScoped bean that’s specific to the XPage.  This bean could be created manually by adding it to faces-config – like I did in show 182.  But that probably isn’t the best way as you don’t want to make a faces-config entry for each bean if you have a ton of pages.  So as an alternative you can use Jesse Gallagher’s frostillicus framework – which is lovely – or on the page you can use the Object Data to create the controller Object right on the page.

<xp:this.data>
<xe:objectData var="controller"
createObject="#{javascript:return new controller.demos();}"></xe:objectData>
</xp:this.data>

So in that instance if I have a java class called “controller.demos” the Object data code will create the object and give it a variable called “controller” and I can now reference it anywhere on the page.  The variable can be anything of course.  Again, all this really seems to be, is a viewScoped managed bean.  By default, this object lives during the life of the page it’s created on.

MODEL: The Model, is the means to actually get to the data itself.  In the JavaCrud app from show 182 I had a java class for “Project” and “Task”.  These classes represent notes documents.  These objects get loaded into the pageController as needed.  Now I admit it seems confusing to have all these similar names.  “project.xsp” for the XPage.  “controller.project” for the page controller and “com.notesIn9.tracker.Project” for the model object.  yuck!  I don’t know a better way really.  There’s a little more flexibility using Object Data but Jesse’s framework requires the pageController to be the exact same name as the XPage itself.  Note that I always try to use lowercase for the controllers and Uppercase for the Model objects.

So why do all this?  as you say “Wow. As dumbed down as this is, this is still a lot.”  And you’re right. It is. But it’s so much better in the long run – though I’ll leave that discussion for a future post or show.  This is long enough now. haha

Hopefully that helps clear things up.  If not let me know.

Dave

 

NotesIn9 192 : Intro to Graph Database in XPages

$
0
0

In this show IBM Champion and all around amazing developer Oliver Busse returns with an EPIC demonstration where he talks about using Graph Databases inside the XPages/Domino world.  I’m far from an expert on them but Graph Databases are what the “Big Boys” like Amazon, Twitter, LinkedIn, etc.. use to more effectively maintain data that relates to other data.  Now you can get started with this inside you’re familiar XPages environment.

This is definitely a show not to be missed!

Note: YouTube is still processing this video. It should be ready shortly.

NotesIn9 198: Convert a Document to a Java Object in XPages

$
0
0

In this show I show you how I typically go about converting a Domino Document to a pure Java Object.

 


NotesIn9 199: Bitmask, Enums and Creating Excel reports from XPages

$
0
0

This is the big one!  The last demo of my presentation at MWLUG 2016.  In this show I’ll demonstrate how you can use something called a “Bitmask” and combine it with some Java code and the Apache Poi project to allow the user to create a custom Excel spreadsheet.  The user will be able to choose any column they want from the data provided and save it to Excel.  Users like that kind of stuff.

NotesIn9 200: Access Server Databases From Code

$
0
0

Wow! Major milestone here. I really don’t want to make too huge a deal of this at the moment but I do have to say thanks for all the contributors that helped the show get to 200 episodes. NotesIn9 has contributed 94 + hours of free tips and tricks to the community.  Most importantly to me, 41 contributors have donated their time and talents to the show and I am so grateful for them helping out with my silly little corner of the Internet. I could never thank them enough.

I had many ideas for what to do with this show and in the end I decided to try and help a viewer who sent me an email. NotesIn9 was created to help others so to me it seems so very appropriate to mark this milestone with at least an attempt at helping others learn to code.

Learn. Code. Share.

 

NotesIn9 207: Send Attachments to 3rd parties

$
0
0

In this show the amazing John Jardin returns with great information on how to get attachments sent to 3rd parties.

Since integration with other systems is becoming more and more critical you certainly want to be thinking about this.



Latest Images