Quick tip: Get hostname with EL

less than 1 minute read

Here’s a quick little tip, something I hadn’t realized before and wanted to share.

Normally when I need to get the host name used in the current request I would do something like:


It’s a Javascript call, which is always slower than pure Java or Expression Language (EL). Where possible I try to use EL instead of Javascript.

So, can you achieve the same result with EL? Yes, and it’s actually pretty straightforward. Just drop the “get” and “()” and fix the case:


There’s another example on the XPages Wiki.

Happy hacking!