Constants are a set of, well, 'constants'. These are values that never change and always have the same value in your project. The cool thing about them is that you can change them between different DTAP settings (dev, testing, acceptation, production).
This helps you if you were to, for instance, want to use a different URL in different environments to call a webservice. Note that you can set the settings for OT in the modeler, but you need to configure them in your application.conf in AP
Constant_mywebserviceURLconstantname = http://www.example.com
Another way is to create a simple JavaAction which just returns the root url:
//2.4 application root
return com.mendix.core.conf.Configuration.getApplicationRootUrl()
//2.5 application root
return com.mendix.core.CoreManager.getInstance().getConfiguration().getApplicationRootUrl()