exception handling causes facesmessages to not be shown
-------------------------------------------------------
Key: JBSEAM-3611
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3611
Project: Seam
Issue Type: Bug
Components: Exception Handling
Affects Versions: 2.0.2.SP1
Environment: ubuntu hardy heron amd64, firefox 3.0.3, jboss-4.2.0.GA_CP01, seam
2.0.2.SP1, richfaces 3.1.4.GA,
Reporter: Ken Gullaksen
Priority: Minor
When using ajax submit to an action method in a conversation scoped bean the following
behavior is encountered.
On fresh deploy notloggedinexception message will be shown. If the page is refreshed and
subsequently another action with @restrict annotation is called, the messages will not be
displayed. There is no warning that facesmessages have been enqeud but not displayed, and
another page refresh will cause the message to be shown.
May be a richfaces bug. I tried with the latest release of richfaces(3.2.2.GA) with same
problem.
CODE:
--pages.xml
<?xml version="1.0" encoding="UTF-8"?>
<pages
xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.0.xsd"
no-conversation-view-id="/home.xhtml"
login-view-id="/home.xhtml">
<page view-id="*">
<navigation from-action="#{identity.logout}">
<redirect view-id="/home.xhtml"/>
</navigation>
</page>
<exception class="org.jboss.seam.security.NotLoggedInException">
<redirect view-id="/home.xhtml">
<message>You must be logged in to use this feature</message>
</redirect>
</exception>
<exception class="org.jboss.seam.security.AuthorizationException">
<redirect view-id="/home.xhtml">
<message>You do not have the necessary security privileges to perform
this action.</message>
</redirect>
</exception>
</pages>
--categoryselector.java
@Conversational
@Scope(CONVERSATION)
@Name("categorySelectorAction")
public class CategorySelectorAction implements Serializable {
private static final long serialVersionUID = -1L;
@In
EntityManager entityManager;
@Logger
private Log log;
@RequestParameter("cat")
private String categoryId;
@Out(required = false)
private String selectedCategory;
@Out(required = false)
private String selectedMenuCategory;
@DataModel(scope = ScopeType.PAGE)
protected List<Category> categoryList;
@Begin(join = true)
@Factory("categoryList")
public void getCategoryList() {
categoryList = new ArrayList<Category>();
for(int i = 0; i < 3; ++i) {
List<Category> subcatList = new ArrayList<Category>();
for(int ii = 0; ii < 3; ++ii) {
subcatList.add(new Category("subcat"+ii));
}
Category cat = new Category("cat"+i, subcatList);
categoryList.add(cat);
}
}
@Begin(join = true)
@Restrict("#{identity.loggedIn}")
public void selectCategory() {
log.error("select category" + categoryId);
selectedCategory = categoryId;
if(!categoryId.contains("sub")) selectedMenuCategory = categoryId;
}
}
--home.xhtml
...
<h:form>
<rich:messages globalOnly="true" ajaxRendered="true"/>
<a4j:repeat var="cat"
value="#{categoryList}">
<a4j:commandLink action="{categorySelectorAction.selectCategory}"
value="#{cat.name}">
<f:param name="cat" value="#{cat.name}"/>
</a4j:commandLink>
<br/>
<a4j:repeat var="subcat"
value="#{cat.subcategories}"
rendered="#{selectedMenuCategory eq cat.name}">
**<a4j:commandLink
action="{categorySelectorAction.selectCategory}"
value="#{subcat.name}">
<f:param name="cat" value="#{subcat.name}"/>
</a4j:commandLink>
<br/>
</a4j:repeat>
</a4j:repeat>
</h:form>
...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira