You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolf Benz <eu...@gmail.com> on 2007/12/27 21:58:16 UTC
access to error messages attributes with unitfied EL
Hi all,
I know that, within a JSP page, you have access to information about
the exception that occurred under several request attribute keys:
javax.servlet.error.exception -- the actual exception itself
javax.servlet.error.status_code -- the HTTP status code (as a
java.lang.Integer)
javax.servlet.error.exception_type -- the Class of the exception
that was thrown
javax.servlet.error.message -- the message string from the
exception that was thrown
javax.servlet.error.request_uri -- the request URI of the
incoming request
javax.servlet.error.servlet_name -- the name of the servlet
processing the request
But if you use JSF & facelets, other than using code in a bean doing
stuff like:
requestMap.get("javax.servlet.error.message");
, is there a way to access them in the pag itself using the unified EL?
What I've already tried, is:
- I tried in y JSF page: #{request.javax.servlet.error.message}, but
got this error:
/resources/pages/fileNotFound.xhtml: Property 'javax' not found on
type org.apache.catalina.core.ApplicationHttpRequest
- I cut out the javax... to no avail.
- I've then tried: #{request['javax.servlet.error.message']}
All failed.
Ideas?
--Wolf
Re: access to error messages attributes with unitfied EL
Posted by Bernhard Huemer <be...@gmail.com>.
Hello,
actually there are two different implicit objects dealing with the
current request: "request" and "requestScope".
"request" -> externalContext.getRequest();
"requestScope" -> externalContext.getRequestMap();
Accordingly, it should work using the following expression:
#{requestScope['javax..servlet.error.message']}
regards,
Bernhard Huemer
On 12/27/2007 +0100,
Wolf Benz <eu...@gmail.com> wrote:
> Hi all,
>
> I know that, within a JSP page, you have access to information about the
> exception that occurred under several request attribute keys:
>
> javax.servlet.error.exception -- the actual exception itself
> javax.servlet.error.status_code -- the HTTP status code (as a
> java.lang.Integer)
> javax.servlet.error.exception_type -- the Class of the exception
> that was thrown
> javax.servlet.error.message -- the message string from the exception
> that was thrown
> javax.servlet.error.request_uri -- the request URI of the incoming
> request
> javax.servlet.error.servlet_name -- the name of the servlet
> processing the request
>
> But if you use JSF & facelets, other than using code in a bean doing
> stuff like:
> requestMap.get("javax.servlet.error.message");
> , is there a way to access them in the pag itself using the unified EL?
>
> What I've already tried, is:
>
> - I tried in y JSF page: #{request.javax.servlet.error.message}, but got
> this error:
> /resources/pages/fileNotFound.xhtml: Property 'javax' not found on type
> org.apache.catalina.core.ApplicationHttpRequest
>
> - I cut out the javax... to no avail.
>
> - I've then tried: #{request['javax.servlet.error.message']}
>
> All failed.
> Ideas?
>
> --Wolf
>
>
>
>
>
>
Re: access to error messages attributes with unitfied EL
Posted by Wolf Benz <eu...@gmail.com>.
Thanks Simon,
The exact error I get, is:
/resources/pages/fileNotFound.xhtml: Property
'javax.servlet.error.request_uri' not found on type
org.apache.catalina.core.ApplicationHttpRequest
javax.el.ELException: /resources/pages/fileNotFound.xhtml: Property
'javax.servlet.error.request_uri' not found on type
org.apache.catalina.core.ApplicationHttpRequest
at
com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:48)
at
com
.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:
39)
at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:246)
at
com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:
577)
at
javax
.faces
.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:45)
at
org
.apache
.myfaces
.trinidadinternal
.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
at
org
.apache
.myfaces
.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:
41)
at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
132)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org
.apache
.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
654)
at
org
.apache
.catalina
.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
447)
at
org
.apache
.catalina
.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at
org
.apache
.catalina
.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at
org
.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:
424)
at
org
.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:
343)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
144)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
104)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
261)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
844)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
447)
at java.lang.Thread.run(Thread.java:613)
... That "javax.servlet.error.message" is on the RequestMap when an
error occures, was found in posting from Craigh M himself. (MF Mailing
list with topic "Re: catch FacesException" - d.d. Sat 18 Feb 2006
20:05:11 GMT+01:00)
--Wolf
_____________
[Hmm..if the code
requestMap.get("javax.servlet.error.message")
works, then I would have really expected
#{request['javax.servlet.error.message']}
to work too.
Is it really the case that the first works, but the second does not?
If the first doesn't work, then that is just a Facelets issue that you
need to follow up on the facelets list..
Regards,
Simon]
Re: access to error messages attributes with unitfied EL
Posted by simon <si...@chello.at>.
On Thu, 2007-12-27 at 21:58 +0100, Wolf Benz wrote:
> Hi all,
>
> I know that, within a JSP page, you have access to information about
> the exception that occurred under several request attribute keys:
>
> javax.servlet.error.exception -- the actual exception itself
> javax.servlet.error.status_code -- the HTTP status code (as a
> java.lang.Integer)
> javax.servlet.error.exception_type -- the Class of the exception
> that was thrown
> javax.servlet.error.message -- the message string from the
> exception that was thrown
> javax.servlet.error.request_uri -- the request URI of the
> incoming request
> javax.servlet.error.servlet_name -- the name of the servlet
> processing the request
>
> But if you use JSF & facelets, other than using code in a bean doing
> stuff like:
> requestMap.get("javax.servlet.error.message");
> , is there a way to access them in the pag itself using the unified EL?
>
> What I've already tried, is:
>
> - I tried in y JSF page: #{request.javax.servlet.error.message}, but
> got this error:
> /resources/pages/fileNotFound.xhtml: Property 'javax' not found on
> type org.apache.catalina.core.ApplicationHttpRequest
>
> - I cut out the javax... to no avail.
>
> - I've then tried: #{request['javax.servlet.error.message']}
Hmm..if the code
requestMap.get("javax.servlet.error.message")
works, then I would have really expected
#{request['javax.servlet.error.message']}
to work too.
Is it really the case that the first works, but the second does not?
If the first doesn't work, then that is just a Facelets issue that you
need to follow up on the facelets list..
Regards,
Simon