[jopr-dev] jsf navigation rule question

John Mazzitelli mazz at redhat.com
Tue Feb 10 21:47:29 EST 2009


 > gotta fix whatever error is happening after you click cancel.

I do not think that's it. There is something not right with the 
navigation rules somewhere.
Here's how you can prove it: in content/create.xhtml, replace the 
<ui:composition> part of that with this:

<ui:composition template="/rhq/entity/layout/main.xhtml">
<ui:define name="content">
      <h:form id="uploadForm" enctype="multipart/form-data">
         <input type="hidden" name="id" value="${param.id}"/>
         <h:panelGrid id="buttonGrid" columns="2" 
styleClass="buttons-table" columnClasses="button-cell">
            <h:commandButton style="margin-top: 10px;" value="CANCEL"
                             action="cancel" styleClass="buttonmed"/>
         </h:panelGrid>
      </h:form>
</ui:define>
</ui:composition>

A very simple page - all it has is that cancel button (I basically 
stripped out the original .xhtml content and just left the form with the 
hidden id field and the cancel button). Now go to that URL:

http://localhost:7080/rhq/resource/content/create.xhtml?id=500551

And click the button. No errors, no JSF error page, no error log 
messages. But, it does go back to the create.xhtml page (without an id= 
param).

Joseph Marques wrote:
> ok, so it turns out this is the standard error handling mechanism for 
> JSF.  if there is some error during the JSF lifecycle, the default 
> navigation handler will *forward* back to the same page you came 
> from.  in this case, you get punted back to "create.xhtml".  and, 
> since we're dealing with forwards, you lose your "state", namely the 
> id parameter.  so, if you want the navigation rule to work, the JSF 
> lifecycle needs to NOT be interrupted.  gotta fix whatever error is 
> happening after you click cancel.
>
> John Mazzitelli wrote:
>> If you go to:
>>
>> http://localhost:7080/rhq/resource/content/create.xhtml?id=500551
>>
>> (where 500551 represents a JBossAS resource in my inventory)
>>
>> and you click cancel, the browser is redirected to this URL:
>>
>> http://localhost:7080/rhq/resource/content/create.xhtml
>>
>> and the page that gets rendered is a generic JSF error page.
>>
>> Here's the thing I don't get. The navigation rules say that upon 
>> cancel, this should go to the deploy.xhtml (with an id param), NOT 
>> create.xhtml:
>>
>>  <navigation-rule>
>>     <from-view-id>/rhq/resource/content/create.xhtml</from-view-id>
>>     <navigation-case>
>>        
>> <from-action>#{CreateNewPackageUIBean.createPackage}</from-action>
>>        <from-outcome>success</from-outcome>
>>        
>> <to-view-id>/rhq/resource/content/confirm-create.xhtml</to-view-id>
>>     </navigation-case>
>>     <navigation-case>
>>        <from-outcome>cancel</from-outcome>
>>        
>> <to-view-id>/rhq/resource/content/deploy.xhtml?id=#{param.id}</to-view-id> 
>>
>>        <redirect/>
>>     </navigation-case>      </navigation-rule>
>>
>> Why is it going to create.xhtml???? Notice it goes there WITHOUT an 
>> "id" parameter, and hence why I think this error is happening. 
>> Something isn't right with our navigation rules now - but obviously, 
>> this USED to work. I'm wondering if Seam created a problem here??
>>
>> _______________________________________________
>> jopr-dev mailing list
>> jopr-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jopr-dev
>
> _______________________________________________
> jopr-dev mailing list
> jopr-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jopr-dev



More information about the jopr-dev mailing list