[jboss-user] [JBoss Seam] - have tried everything - what todo about bug in seam exceptio
X490812
do-not-reply at jboss.com
Mon Dec 3 15:49:29 EST 2007
I have tried everuything listed here. There still seams to be a bug - In fact I built a dummy app to isolate the problem.
Here is pages.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <pages>
| <exception ><redirect view-id="/genericErrorPage.xhtml"/></exception>
| </pages>
|
here is my backing bean:
| package com.homeq.tst.action;
| import javax.ejb.Stateless;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.faces.FacesMessages;
| @Stateless
| @Name("EXCEPTTEST")
| public class ExceptionTest implements IExceptionTest {
| @In
| @Out
| FacesMessages facesMessages;
| public String tst() throws Exception {
| facesMessages.add("TestMessage");
| if (false)
| throw new Exception("testexception");
| else
| return "/genericErrorPage.xhtml";
| }
| }
|
here is genericErrorPage.xhtml
| <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html
| xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
| <head>
| <title>Error Page</title>
| </head>
| <body>
| <h:messages/>
| </body>
| </html>
|
herre is mypage.xhtml
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
| <head>
| <title>hello world</title>
| </head>
| <body >
| HELLO WORLD
| <h:form >
| <h:commandButton action="#{EXCEPTTEST.tst}"/>
| </h:form>
| </body>
| </html>
|
I goto mypage.seam, hit the commandButton . If I have set the test flag (see backing bean code if condition) to true, then I execute the exception and facesMessages gets blown away and "testexception" is displayed by genericErrorPage. If I set the testflag to false, then I simply render genericErrorPage.xhtml and the facesMessages shows the correct message. Why does facesMessages get blown away when exception is thrown?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110006#4110006
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110006
More information about the jboss-user
mailing list