Very Very Urgent- help me out, regarding selectoneMenu
Hi
I am using a selectoneMenu , In the drop down box iam populating the
values which are coming from a the list. I am setting the value of selectOneMenu to"id", I can capture the id and I can query the database to get the other details , but I need the display value.
For example: In the genertated html by the jsf looks likethis
<option value =1 >giff</option>
<option value =2 >John</option>
<option value =3 >stefhen</option>
<option value =4 >Dan</option>
<option value =5 >Steve</option>
I want the selected display value ...example :"giff " by the user.
The referthis codefor understanding:
list:
/**
* It retrieves all the Service Domains from the database based on the
* database selected on the UI.
*/
privatevoid querySDFilterList()
{
int selectedDb = NrsmUtil.getUserSelectedDB();
FacesContext facesContext = FacesContext.getCurrentInstance();
// The variable holds the selected Database value 0 = ACTIVE ,
// 1 = STANDBY and -1 = Neither Active nor Standby.
if (selectedDb == UIConstants.NOT_ACTIVE_STANDBY_DB)
{
// If the selectedDB value is -1 = Neither Active nor Standby
// other than 0= Active or 1= Standby, throw the error message
// in UI.
log.error("Unknown DB value obtained" );
// TODO: how to get form error insert tag
facesContext.addMessage(
UIConstants.L1DOMAIN_TAB,new FacesMessage(
MESSAGE_BUNDLE.getString("WC4006" ) ) );
}
//successfully got selectedDb value
else
{
try
{
ArrayList<SelectItem> filterList =new ArrayList<SelectItem>();
SDMger sDMger =new SDMgerImpl();
SDomain[] sDomains =
sDomainMger.getAllSDomains( selectedDb );
//check query returns
if (sDomains !=null)
{
// set top filter list selection for all service domain with
// value is empty
SelectItem item =
new SelectItem( UIConstants.ALL_COMPONENT_CONFIGURED,
SERVICE_DOMAIN_UI_MESSAGE
.getString("allSDomains" ) );
filterList.add( item );
// add the All SDomains as an option in the UI.
// set sdomain ID is selection value, name is text
// selection
for (int i = 0; i < sDomains.length; i++)
{
item =
new SelectItem( sDomains[i].getId(),
sDomains[i].getName() );
filterList.add( item );
}
}
//no service domain configured
else
{
// set selection text as "No service domain configured" with
// value is "-1"
SelectItem item =
new SelectItem( UIConstants.NO_COMPONENT_CONFIGURED,
SERVICE_DOMAIN_UI_MESSAGE
.getString("noServiceDomainConfigured" ) );
filterList.add( item );
// set parent sdomain Id to no component configured
this.setPserviceDomainId( UIConstants.NO_COMPONENT_CONFIGURED );
}
// set server domain filter list
this.setServiceDomainFilterList( filterList );
}
catch (NrsProvisionException provExcep)
{
log.error("Exception occured in populating Service Domains",
provExcep );
}
}
}
<Jsp Code->
<h:selectOneMenu value="#{EndpointSearchHandler.dsEventHdlr.pserviceDomainId}"
valueChangeListener="#{EndpointSearchHandler.dsEventHdlr.handleSDSelection}"
immediate="true" onchange="this.form.submit()"
>
<f:selectItems
value="#{EndpointSearchHandler.dsEventHdlr.serviceDomainFilterList}" />
</h:selectOneMenu>

