Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF reRender

794404Nov 21 2009 — edited Dec 5 2009
Hi,

I have a datagrid in which there are pictures about products. When the user clicks on a picture it gives a modalPanel to enter qty. Once the user enter the qty and click add, it goes back to the previous page, where the user can select a different product to enter qty again.

But when the user clicks on a different product, it shows the modalPanel with the previous qty entered. I want that qty to be cleared before the user enters the qty for the new product. I used reRender but it doesnt help.

   <head>
      <title> The Shop</title>
      	</head>

  <body>
  
  	 <rich:modalPanel id="modalPanel">
	<f:facet name="header">
		Enter Qty
	</f:facet>
	<h:form>
	<h:panelGrid>
	
		<h:outputText value="Enter Qty: " />
		
		<h:inputText id ="qty" value="#{orderBean.qty}" />
		
		<h:panelGroup>
				
		<a4j:commandButton value="Add" id="add" action="#{orderBean.addProduct}" reRender="form"
		oncomplete="Richfaces.hideModalPanel('modalPanel')" >
		
  		</a4j:commandButton>
				
		<a4j:commandButton value="Back" id="back" 
		oncomplete="Richfaces.hideModalPanel('modalPanel')" />
		
		</h:panelGroup>
		</h:panelGrid>
		</h:form>
		</rich:modalPanel>
				
		<br/>
		<br/>
		
	                 <f:view>
                              	<h:form id= "form">
  	 	  <h:outputText value="Choose Your Product" style="font-style: italic; font-size: 1.4em"/>
  	               <br/>
  	               <br/>
  	
                         <rich:dataGrid id="info" border="0" value="#{productBean.productList}" var="product"  columns ="2" >
  	
   			
  	         <h:panelGrid id = "myDataGrid"   border="0" columns="2">
  	      
 		<a4j:commandLink onclick="#{rich:component('modalPanel')}.show()"><h:graphicImage value="/images/#{product.imageName}"  /> 
  		 <a4j:actionparam name="productID" value="#{product.productID}" assignTo="#{orderBean.productID}"/>
  		</a4j:commandLink>
  		<h:outputText value=" $ #{product.price}" /> 
  		 
  		 
  	            </h:panelGrid>

                    </rich:dataGrid>
  
  	  	  	  		  	
                  <br/>
                 <br/>
  
  	<a4j:commandButton value="Back" id="back" reRender="qty"
	oncomplete="Richfaces.hideModalPanel('modalPanel2')" />
	  </h:form>
                 </p>
             </f:view>
           </body>
 
            </html>
  	
Appreciate your help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2010
Added on Nov 21 2009
14 comments
800 views