I have managed bean, and want to divide logic inside one of its methods according to which page called it, does some way exist to achieve this?
This is available by UIViewRoot#getViewId()
.
String viewId = FacesContext.getCurrentInstance().getViewRoot().getViewId();
I must however say that this is somewhat a smell. Depending on the concrete functional requirement for which you thought that examining the calling XHTML page would be the right solution, there may be better ways to achieve the concrete functional requirement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With