1

I am trying to use Mojarra 2.3.0-m02. Confirming the JSF configuration file faces-config.xml to be compatible with JSF 2.3 as follows.

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.3"
              xmlns="http://xmlns.jcp.org/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
              http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd">

</faces-config>

I am currently on a toy blank playground project having nothing other than a single XHTML file and one or two managed beans (CDI). No additional dependencies like PrimeFaces, OmniFaces.

The following

<h:outputText value="contextPath : #{request.contextPath}"/>

is evaluated to null (empty string?). Reverting back the faces-config.xml file to be JSF 2.2 specific shows the correct context path as expected.

What is the culprit? (I am using GlassFish Server 4.1).


Additional:

I have used it the following way on the project's master template.

<ui:param name="contextPath" value="#{request.contextPath}"/>

and then used contextPath in EL like #{contextPath} at several places throughout the application.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Tiny
  • 27,221
  • 105
  • 339
  • 599
  • 1
    Reproduced. `#{facesContext.externalContext.requestContextPath}` works fine as workaround. Whole `#{request}` is absent (but `#{session}` and `#{application}` are present). Haven't checked the cause yet. – BalusC May 04 '15 at 16:14
  • 1
    Thanks a bunch for testing this! In 2.3 mode the `#{session}` and `#{application}` are now resolved via a dynamic producer (`Bean`) where the name property is non empty. See e.g. https://github.com/omnifaces/mojarra/blob/master/jsf-ri/src/main/java/com/sun/faces/cdi/SessionProducer.java There's no producer for "request" at the moment. Likely the entire old (JSF specific) EL resolver for implicit objects is not used in 2.3 mode. I'll take this up with Manfred and see where things need to be fixed. – Arjan Tijms May 04 '15 at 19:56

1 Answers1

2

First of all, JSF 2.3 is currently still in "alpha" (development) stage with milestone releases so now and then. So it's expected that some things are not finished yet or perhaps just overlooked. Nonetheless, testing of milestone releases and reporting any issues is very much appreciated.

One of things which changed in JSF 2.3, which will be the first version to require CDI, is that all implicit EL objects are resolved via CDI producers instead of an EL resolver. This turns out to be still work in progress. Not only #{request} is missing, but also among others #{header}, #{initParam}, #{param} and even #{cc} and #{component} are missing in m02.

It will likely come in the next milestone.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555