shale-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dick Starr" <d...@medibadge.com>
Subject RE: Why do I need to click my action method commandButton twice?
Date Mon, 30 Oct 2006 20:45:41 GMT
Thanks for the response.

I am using Tiles and had my <h:messages/> in my header, although I had globalOnly set
to true, which which I have now set to true.

I again went through every thing I could think of to try, but with no solution. I do however,
have a pretty good hint - I think.

Although I gave one example there are others. Generally, my action methods fail - even a simple
cancel (although sometimes they do work).

Here is what always happens when it fails. I noticed that in my Firefox browser url, before
the first click (which fails) it show the url of the previous jsp (not the one I am seeing).
Once I do the first click the url shows the jsp I am seeing; then I click the second time
and it works. Hopefully this hint will tell someone the answer.

Here are the navigation rules for my original example. Everything points to a Tile (note that
I end my <from-view-id> with a ".jsp" - as it won't work otherwise). I start with the
search jsp and click the new case.

<navigation-rule>
    <from-view-id>/systemOperatorMnt.jsp</from-view-id>
    <navigation-case>
      <from-outcome>cancel</from-outcome>
      <to-view-id>/systemOperatorMntSearch</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/menuAdmin</to-view-id>
    </navigation-case>
  </navigation-rule>
  
  <navigation-rule>
    <from-view-id>/systemOperatorMntSearch.jsp</from-view-id>
    <navigation-case>
      <from-outcome>cancel</from-outcome>
      <to-view-id>/menuAdmin</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>new</from-outcome>
      <to-view-id>/systemOperatorMnt</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/menuAdmin</to-view-id>
    </navigation-case>
  </navigation-rule>

Here is my Tiles header:

<%-- header.jsp
  2006-10-30 RJS. New.
--%>
<%@ include file="/jspf/common/taglibs.jsp" %>
<%@ include file="/jspf/common/messages.jsp" %>
<h:panelGrid columns="3" styleClass="starraHeader">
  <h:messages
   errorClass="starraMsgError"
   globalOnly="false"
   infoClass="starraMsgInfo"
   styleClass="starraHeaderLeft"
   warnClass="starraMsgWarn"/>
  <h:panelGroup styleClass="starraHeaderCenter">
    <h:outputText value="#{msg['app.title.sa']}"/>
    <h:outputText value=" #{msg['symbol.sep1']}"/>
    <h:outputText value=" #{msg['app.user']}"/>
    <h:outputText value="#{msg['symbol.equals']}"/>
    <h:outputText value="#{stateSession.logonName}"/>
  </h:panelGroup>
  <h:form id="directJump">
    <h:panelGroup>
      <h:selectOneMenu
       binding="#{systemDirectJump.htmlSelectOneMenu}"
       styleClass="starraHeaderRight">
        <f:selectItem itemLabel="#{home.header}" itemValue="systemDirectJumpHomeMenu"/>
        <f:selectItem itemLabel="#{admin.header}" itemValue="systemDirectJumpAdminMenu"/>
      </h:selectOneMenu>
      <h:outputText value=" "/>
      <h:commandButton
       action="#{systemDirectJump.jump}"
       id="directJumpSubmit"
       immediate="true"
       styleClass="starraButtons"
       value="#{msg['button.Jump']}"/>        
    </h:panelGroup>
  </h:form>
</h:panelGrid>

Thanks again.

----
Dick

-----Original Message-----
From:	Craig McClanahan [mailto:craigmcc@apache.org]
Sent:	Mon 10/30/2006 11:32 AM
To:	user@shale.apache.org; Dick Starr
Cc:	
Subject:	Re: Why do I need to click my action method commandButton twice?



On 10/30/06, Dick Starr <dick@medibadge.com> wrote:

	I am using the 10/4/06 version of Shale.
	
	I have an h:form containing a h:panelGrid whose footer contains a
	h:commandButton in its footer as follows:
	
	<h:commandButton action="#{systemOperatorMnt.create }"
	    id="mntButtonsCreate"
	    value="Create"/>
	
	I fill in the form and click the "Create" button and my form clears
	without the "create" method being executed. 
	
	I fill in the form again (so I get past validation) and click the
	"Create" button. This time the "create" method is executed.
	
	I must be missing something. Could you please tell me:
	
	Why is my form being cleared the first time I click "Create"?
	
	Why do I need to click the "Create" button twice?


The most common cause for this type of scenario (generic to JSF apps, not specific to Shale)
is that some conversion or validation error occurred, but you don't have message components
to show them.  In that situation, JSF's standard behavior is to abort the request processing
lifecycle after the phase in which the error is encountered -- which is usually Process Validations.


In your case, you have <h:message> components for each input field ... but what happens
if an error occurs that is not associated with a particular input component?  Try sticking
an <h:messages/> component somewhere on the page, to see if it lists any additional
errors. 
 



	Thanks in advance,
	
	Dick Starr



Craig






Mime
View raw message