thx, Craig!


On 29 Aug 2005, at 0:02, Craig McClanahan wrote:

On 8/28/05, ir. ing. Jan Dockx <[EMAIL PROTECTED]> wrote:
Good point, I think, and no, I can't think of a rationale.


The key issue is that expression evaluation occurs with respect to a
context ... specifically, the FacesContext for the current request,
which contains internal references to (in a webapp) a ServletContext,
a ServletRequest, and a ServletResponse. There can't be such a "real"
object at application startup time, because there is no request in
place.

You could work around the limitation by initializing the objects you
need in a servlet context listener though, and store them in
application scope yourself. You are not using the managed bean (~ IoC)
mechanism then though.

If, however, you just access the VariableResolver in your context
listener, the beans get initialized and get stored in the scope they
are defined for.


That won't necessarily be sufficient if your managed bean declaration
has managed properties that are also initialized via value binding
expressions. The JSF framework will be applying its usual expression
evaluation facilities to that kind of an expression.

An alternative that might work, though, is to construct a mock
ExternalContext with only the ServletContext object, and no request
and response, and then construct a mock FacesContext wrapping that.
You should be able to evaluate expressions that don't attempt to
access things from request or session scope.

Craig


<x-tad-smaller>Met vriendelijke groeten,

Jan Dockx
</x-tad-smaller><x-tad-smaller>
PeopleWare NV - Head Office</x-tad-smaller>
<x-tad-smaller>
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66 </x-tad-smaller>
<x-tad-bigger>
</x-tad-bigger>
<x-tad-smaller>
PeopleWare NV - Branch Office Geel</x-tad-smaller>
<x-tad-smaller>
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25</x-tad-smaller>
<x-tad-bigger>
</x-tad-bigger>
<x-tad-smaller>
http://www.peopleware.be/
</x-tad-smaller><x-tad-smaller>http://www.mobileware.be/</x-tad-smaller>

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to