[jboss-user] [JBoss Seam] - best practices with Seam and presentation logic

asookazian do-not-reply at jboss.com
Wed Dec 26 12:45:44 EST 2007


So I have a use case where I need to reset the selected value of the h:selectOneMenu. I am using the following code to tracke the old and new values: 

<h:form id="peerForm">
  |    			<h:selectOneMenu id="selectPeer" value="#{peerAction.employeeId}" valueChangeListener="#{peerAction.processValueChange}">   			
  |    			 	<a4j:support event="onchange"   
  |    			 				 onchange="Richfaces.showModalPanel('mpChangePeer',{width:450, top:200})"/>
  | 			  <f:selectItems value="#{peerAction.peers}" />
  | 			</h:selectOneMenu>			
  |    		</h:form> 	 


SFSB: 


private String selectedValue;
  | 	
  | private String oldValue;
  | 
  | public void processValueChange(ValueChangeEvent value) {
  | 		 selectedValue = (String)value.getNewValue();
  | 		 oldValue      = (String)value.getOldValue();
  | 	}	 


I know from previous post that Pete had stated it's bad practice to handle presentation logic in a session bean (which I won't argue with although it does get confusing when SFSB's are essentially backing bean for JSF's). 

The two options are: 

1) to use Seam remoting to access the old value from client side and reset selected value via javascript. 

2) reconstruct the HtmlSelectOneMenu component in a POJO/SFSB. 

What is the recommended best practice according to Seam framework regarding this situation???

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

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



More information about the jboss-user mailing list