[jboss-user] [JBoss Seam] - please help me out of this problem

mnrz do-not-reply at jboss.com
Thu Aug 30 08:29:02 EDT 2007


Hi

I have a SFSB as follows, it has an entity named "user", in page when I change a list box I want the selected user to be loaded but nothing will be displayed


  | @Stateful
  | @Name("userRegister")
  | @Scope(ScopeType.SESSION)
  | public class UserRegisterAction implements UserRegister  {
  | 
  | 	private Log logger = LogFactory.getLog(UserRegisterAction.class);
  | 
  | 	private User user;
  | 	private String selectedUsername = "0";
  |         
  |         //rest of the codes....	
  | 
  |         	public void userListValueChanged(ValueChangeEvent event) {
  | 
  | 		try {
  | 			selectedUsername = (String) event.getNewValue();
  | 			if(selectedUsername.equals("0")){
  | 				logger.debug("new user");
  | 				User u = new User();
  | 				setUser(u);
  | 			}else{
  | 				logger.debug("edit:"+ selectedUsername);
  | 				User u = userDao.load(selectedUsername);
  | 				setUser(u);
  | 				logger.debug("test:"+ user.getUsername());
  | 			}
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 		}
  | 	}
  | 
  | 
  | 
  |          //getters and setters....
  | 

now in xhtml file:


  | 									<h:panelGroup id="exportUser">
  | 										<h:outputLabel id="userL"
  | 											value="#{bundle['userDefination.group']}" for="groupMenu" />
  | 										<t:selectOneMenu id="userMenu" required="false" value="#{userRegister.selectedUsername}"
  | 									    	valueChangeListener="#{userRegister.userListValueChanged}"
  | 											onchange="submit(this)" >
  | 											<f:selectItem itemLabel="New User ..." itemValue="0" />
  | 											<f:selectItems id="userList" value="#{userRegister.allUsers}" />
  | 										</t:selectOneMenu>
  | 									</h:panelGroup>
  | 
  | 

after the user change the list this form will submit but any reference to userRegister.user.username or other properties of user don't work .

at first, user is not null it is a user with null property values. the thing wondering me is that in change value listener I load the user with new values but new values won't be displayed at page!!!

and #{userRegister.user} returns the object reference of User with the same value that it was already.

any help would be appreciated

thanks

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

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



More information about the jboss-user mailing list