[jboss-user] [JBoss Seam] - resetting/clearing a session scoped SFSB

asookazian do-not-reply at jboss.com
Fri Dec 21 16:07:43 EST 2007

I have a conversation scoped SFSB which has a session scoped SFSB injected into it as follows:

  | private NoteLocal noteAction;

In my xhtml, there is a h:selectOneMenu coded as follows:

  | <h:form id="peerForm">
  |    			<h:selectOneMenu id="selectPeer" value="#{peerAction.employeeId}">
  |    			 	<a4j:support event="onchange"   
  |    			 				 onchange="changePeer()"/>
  | 			  <f:selectItems value="#{peerAction.peers}" />
  | 			</h:selectOneMenu>			
  |    		</h:form>   

The javascript function changePeer() does the following:

  | function changePeer() {		
  | 		Richfaces.showModalPanel('mpChangePeer',{width:450, top:200});
  | 	}

And the modalPanel is as follows:

  |   <rich:modalPanel  id="mpChangePeer" minHeight="200" minWidth="450" 
  |             height="500" width="500" zindex="2000">    
  |             <f:facet name="header">
  | 	                <a4j:outputPanel>
  | 	                	<h:outputText id="mpChangePeerWarning" value="Warning"/>
  | 	                </a4j:outputPanel>
  | 	        </f:facet>
  |           	<a4j:form id="a4jChangePeer"> 
  | 	        	    <h:outputText value="Are you sure you want to switch to a peer?  You will lose all unsaved changes."/>
  | 	        	    <BR/>
  | 	        	    <h:panelGrid columns="2">
  | 		        	    <a4j:commandButton value="Continue" 
  | 		        	    				   action="#{securityAuditAction.findAuditList}"
  | 		        	    				   onclick="Richfaces.hideModalPanel('mpChangePeer')"
  | 	   						     		   ajaxSingle="true"
  | 	   						     		   reRender="mainForm"/> 
  | 		        	    <BR/>
  | 		        	    <a4j:commandButton value="Cancel" onclick="Richfaces.hideModalPanel('mpChangePeer')"/>
  | 		        	</h:panelGrid>
  | 	        </a4j:form>
  |     	</rich:modalPanel>

My question is when the user clicks 'Continue' button, I need to reset and/or clear and/or instantiate a new instance of the session scoped SFSB so that the data is fresh/clear and data shows properly in the dataTable of the main form.

What is the best way to do this in Seam?

The other question (which I may post on richfaces forum) is that if they click 'Cancel' then I need to reset to h:selectOneMenu value to the previous value.  How do I do this?  thx.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115132#4115132

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115132

More information about the jboss-user mailing list