Easiesy way should be using the binding attribute.
JSF<h:selectOneListbox binding="#{myBean.listbox1}" />
<h:selectOneListbox binding="#{myBean.listbox2}" />
<h:commandButton action="#{myBean.moveData}" />
Beanprivate HtmlSelectOneListbox listbox1;
private HtmlSelectOneListbox listbox2;
// plus getters and setters
public void moveData() {
listbox2.setValue(listbox1.getValue());
}
Untested, but this might give you an idea anyway.
[code]Hi,
this is one way it is right or wrong i dont know but it is working for me
jsp page
<h:panelGroup>
<h:selectOneMenu id="host" binding="#{HRselforeachappvm.selectonelist}" value="#{HRselforeachappvm.host}"
valueChangeListener="#{HRselforeachappvm.hostSelection}" onchange="submit();"immediate="true" required="true">
<f:selectItem itemValue="" itemLabel=""/>
<f:selectItems value="#{HRselforeachappvm.hosts}"/>
</h:selectOneMenu>
<h:message for="host" style="color:red"/>
</h:panelGroup>
<h:outputText value="SelectAPPlication" />
<h:panelGroup>
<h:selectOneMenu id="appcpu" value="#{HRselforeachappvm.user}" required="true">
<f:selectItem itemValue="" itemLabel=" "/>
<f:selectItems value="#{HRselforeachappvm.users}"/>
</h:selectOneMenu>
backing bean
public void setSelectonelist(UISelectOne selectone){
this.selectone=selectone;
}
public UISelectOne getSelectonelist(){
return selectone;
}
public void hostSelection(ValueChangeEvent ee)
throws AbortProcessingException
{
System.out.println("valuechangeevent");
FacesContext context = FacesContext.getCurrentInstance();
getUsers();
context.renderResponse();
}
public Map getUsers(){
try{
if(selectone!=null)
hostselected= (String)selectone.getLocalValue();// v .v imp note
else
hostselected=" ";
System.out.println("getting the selectedhost"+hostselected);
openConnection();
String str="select distinct pd_user from sp_process_detail_current where host_id=?";
System.out.println("setting users from host");
ps=con.prepareStatement(str);
ps.setString(1,hostselected);
ps.execute();
rs=ps.getResultSet();
while(rs.next()){
pd_user=rs.getString("pd_user");
System.out.println(pd_user);
selusernames.put(pd_user,pd_user);
}
return selusernames;
}
catch(SQLException e){
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
finally{
try{
if(rs!=null)
rs.close();
rs=null;
}
catch(SQLException e){
e.printStackTrace();
}
try{
if(ps!=null)
ps.close();
ps=null;
}
catch(SQLException e){
e.printStackTrace();
}
try{
close();
}
catch(SQLException e){
e.printStackTrace();
}
}
return selusernames;
}
[/code]
[b]HI BalusC ,
ya but without local submitting onchange="submit();"
value change listener does not work.
actually the value change listener example
is like that in core java server faces.
but i tried with out using local submitting
onchange=submi();"
but it is not working
you also try that
with regards
shannu sarma[/b]
Message was edited by:
shannu
Message was edited by:
shannu