How to check if a page is a detail page
“When building lists of content, it's a typical requirement to link from a condensed view of the content to a more detailed view. For example, in a list of news, only title, teaser and maybe a date and author are displayed. You click on a news to get to a page showing the complete news article. Similarly, events, products or any other type of resource/content may be shown in a list with links to a detailed view added” (form https://documentation.opencms.org)
But how we can state programmatically if a page is a detail page?
We can use the class CmsJspStandardContextBean and the class method “isDetailRequest”, as for the following example:
CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance( request );
if (contextBean.isDetailRequest() ) {
some_action;
}
else{
other_action;
}
The method can be useful if the same page shows both the list and the detail content.
In this case, my purpose could be to show a given content by using the above method.