To solve this question, the user needs to know about JSF expressions and how they can reference an application's context path.
Option A: #{contextPath} - This option is not correct. There is no JSF implicit object named contextPath
. This option seems to be a custom attribute, which is not defined in the JSF specification.
Option B: #{requestContextPath} - This option is not correct. There is no JSF implicit object named requestContextPath
. This option seems to be a custom attribute, which is not defined in the JSF specification.
Option C: #{facesContext.externalContext.requestContextPath} - This option is correct. This expression references an application's context path using facesContext.externalContext.requestContextPath
. This expression is used to get the application's context path that the current request is mapped to.
Option D: ${request.contextPath} - This option is not correct. This expression is not a JSF expression. It is a JSP expression that is used to get the context path of the current request.
Therefore, the correct answer is:
The Answer is: C. #{facesContext.externalContext.requestContextPath}