So in the previous part we wrote our first bit of java code, a method ( getMyInternetAddress) in a class ( AboutMe ) in a package ( scary.java.demo ). So the question remains, how do I actually use that in my XPage applications?
So remember that link that had a big ssjs code block in it? To use the new java code instead you can just replace the ssjs with a single line that reads
and the xpage can be saved and previewed and it will do the exact same as what the long ssjs version did. The generated java for the page now looks like this
You will notice that I’m still using ssjs and the resulting java still uses this ValueBinding concept to run the ssjs at runtime. While there are ways to avoid ssjs totally ( which I’ll explain in upcoming parts ) this is actually a tiny little bit better then before because your scary.java.demo.AboutMe class already compiled and optimized by the compiler, meaning it runs much faster then the long ssjs version.
Wouldn’t it be much better if I could get rid of the ssjs entirely? I’ll look at this in the next few parts but next we need to talk about another scary word, Beans…