[seam-issues] [JBoss JIRA] (JBSEAM-4944) JPDL Pageflow broken in JSF2
Andrea Martino (JIRA)
jira-events at lists.jboss.org
Thu May 3 05:27:18 EDT 2012
[ https://issues.jboss.org/browse/JBSEAM-4944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689959#comment-12689959 ]
Andrea Martino commented on JBSEAM-4944:
----------------------------------------
Sorry for spamming, I found the reason the error.
My JSF form used a custom converter in the input field, as following:
{code}
<h:form>
<h:inputText id="name" converter="trimConverter" value="#{customerSearch.name}" />
<h:commandButton value="Search" action="#{customerSearch.search}" />
</h:form>
{code}
The custom converter source code was a Seam annotaded component, as following:
{code:title=TrimConverter.java}
package com.example.converter;
import static org.jboss.seam.ScopeType.STATELESS;
import java.io.Serializable;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.faces.Converter;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
@Name("trimConverter")
@BypassInterceptors
@Scope(STATELESS)
@Converter
public class TrimConverter implements javax.faces.convert.Converter, Serializable {
private static final long serialVersionUID = 6902673847999844992L;
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
return value != null ? value.trim() : value;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
return value instanceof String ? (String)value : null;
}
}
{code}
This combination of JSF2 + Seam annotated converter breaks the JPDL navigation. If instead, the converter is annotated using *@javax.faces.convert.FacesConverter*, everything works as expected.
{code:title=TrimConveter.java}
package com.example.converter;
import java.io.Serializable;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@javax.faces.convert.FacesConverter("trimConverter")
public class TrimConverter implements javax.faces.convert.Converter, Serializable {
private static final long serialVersionUID = 6902673847999844992L;
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
return value != null ? value.trim() : value;
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
return value instanceof String ? (String)value : null;
}
}
{code}
Should I open another bug or this issue can be fixed here?
> JPDL Pageflow broken in JSF2
> ----------------------------
>
> Key: JBSEAM-4944
> URL: https://issues.jboss.org/browse/JBSEAM-4944
> Project: Seam 2
> Issue Type: Bug
> Components: JSF Integration
> Affects Versions: 2.3.0.BETA1
> Environment: JBOSS 7.1 + JSF2 + RichFaces 4.2.0.Final
> Reporter: Andrea Martino
> Labels: navigation, pageflow
>
> The pageflow navigation is broken in Seam 2.3.0.Beta1 when using JSF2.0.
> I defined a pageflow as following:
> {code:xml|title=pageflow.jpdl.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <pageflow-definition name="captureorder">
> <start-state>
> <transition name="customersearch" to="customersearch"/>
> </start-state>
>
> <page name="customersearch" view-id="/customersearch.xhtml">
> <transition name="customeroverview" to="customeroverview" />
> </page>
>
> <page name="customeroverview" view-id="/customeroverview.xhtml" />
> </pageflow-definition>
> {code}
> The page customersearch.xhtml calls a method in the controller that returns "customeroverview" as following:
> {code:xml:title=customersearch.xhtml}
> <h:form>
> <h:inputText id="name" value="#{customerSearch.name}" />
> <h:commandButton value="Search" action="#{customerSearch.search}" />
> </h:form>
> {code}
> The browser is never redirected to the "customeroverview" page.
> Somehow the class *org.jboss.seam.jsf.SeamNavigationHandler* in method *handleNavigation* calls baseNavigationHandler (the last method) instead of Pageflow.instance().navigate (which would be correct in this case)
> {code:title=org.jboss.seam.jsf.SeamNavigationHandler}
> @Override
> public void handleNavigation(FacesContext context, String fromAction, String outcome)
> {
> if ( !context.getResponseComplete() ) //workaround for a bug in MyFaces
> {
> if ( isOutcomeViewId(outcome) )
> {
> FacesManager.instance().interpolateAndRedirect(outcome);
> }
> else if ( Init.instance().isJbpmInstalled() && Pageflow.instance().isInProcess() && Pageflow.instance().hasTransition(outcome) )
> {
> Pageflow.instance().navigate(context, outcome);
> }
> else if ( !Pages.instance().navigate(context, fromAction, outcome) )
> {
> baseNavigationHandler.handleNavigation(context, fromAction, outcome);
> }
> }
> }
> {code}
> The reason for this behavior, is that *Pageflow.instance().isInProcess()* returns false, even if the page with the form was reached inside a pageflow.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list