how to call collection in dropdown using selectitems in java server faces?

I have written a bean called comboboxbean & in faces-config mentioned its reference. Now when i try to call it inside <select items>

like #{comboboxbean.combovalues}

I am getting class not found and can not get value for combovalues etc.

Now either i am missing something or there is some configuration mismatch.

here are the things i did in detail:

public class ComboBoxTestBean

{

ProcessHelper procHelp = new ProcessHelper();

Project projObj=null;

String projectName="";

String projectId="";

List comboValues = new ArrayList();

private Object value = "Select from the dropdown list";

public ComboBoxTestBean(){

for(Iterator iter = procHelp.getAllProjects().iterator(); iter.hasNext(); )

{

projObj = (Project)iter.next();

projectId=projObj.getProjectID();

projectName=projObj.getProjectName();

comboValues.add(new SelectItem(projectName+"_"+projectId));

}

}

private void changeItems(String value){

//We can put a check for the prev matching-word and present word to avoid the below processing. (previous matching-word is not saved right now)

if(value == null)

return;

comboValues.clear();

for(Iterator iter = procHelp.getAllProjects().iterator(); iter.hasNext(); )

{

projObj = (Project)iter.next();

projectName=projObj.getProjectName();

projectId=projObj.getProjectID();

if(projectName.startsWith(value)){

comboValues.add(new SelectItem(projectName+"_"+projectId));

}

}

}

public void setComboValues(List comboValues){

this.comboValues = comboValues;

}

public List getComboValues(){

FacesContext context = FacesContext.getCurrentInstance();

ComboBox combo = (ComboBox)context.getViewRoot().findComponent("doSearch:dropDownComboId2");

String value = combo.getMatchingWord();//retrieves the matching word (given in the input-text)

System.out.println("value = "+value);

changeItems(value);

System.out.println("this.comboValues = "+this.comboValues);

return this.comboValues;

}

public void setValue( Object value )

{

this.value = value;

}

public Object getValue()

{

return value;

}

}

and in faces-config.xml its like:

<managed-bean>

<description> Bean to test the drop-down comboBox functionality</description>

<managed-bean-name>ComboBoxTestBean</managed-bean-name>

<managed-bean-class>ComboBoxTestBean</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

Now trying to use in jsp as:

<ca_h:label id="dropL1" value="SelectProject:" for="dropDownComboId2" rendered="true"/>

<ca_h:comboBox id="dropDownComboId2" value="#{ComboBoxTestBean.value}" accessKey="e" isAJAXEnabled="true" size="10" type="dropDownCombo">

<f:selectItems value="#{ComboBoxTestBean.comboValues}" />

</ca_h:comboBox>

Now there are some other things.

this whole thing if i keep inside jsp i.e. bean then some extar things used are these:

<%

Object obj = session.getAttribute("dropDownComboBoxTestBean_ajax");

if(obj == null || obj instanceof ComboBoxTestBean){

obj = new ComboBoxTestBean();

session.setAttribute("dropDownComboBoxTestBean_ajax", obj);

}

%>

and

<%

FacesContext context = FacesContext.getCurrentInstance();

StateManager stateManager = context.getApplication().getStateManager();

SerializedView view = stateManager.saveSerializedView( context );

//System.out.println("ssss "+stateManager.isSavingStateInClient(context));

if(stateManager.isSavingStateInClient(context))

{

stateManager.writeState(context, view);

//System.out.println("ddddd");

}

else{

Object myfacesSeqParam = context.getExternalContext().getRequestMap().get("jsf_sequence");

if(myfacesSeqParam == null)

myfacesSeqParam = context.getExternalContext().getSessionMap().get("jsf_sequence");

out.println("<input type='hidden' name='jsf_sequence' id='jsf_sequence' value='"+myfacesSeqParam+"'>");

}

%>

but i don't know why they are getting used.

and in case i need to use many beans to display many combo the do i still need to keep them in jsp or should i place it in any bean.

Please guide me i am not in right track.

thanks

vijendra

[4655 byte] By [vj_makera] at [2007-11-27 9:37:03]
# 1
> I am getting class not foundDoublecheck if the managed-bean-class setting in faces-config.xml is correct and if the given class is actually been put in a package.
BalusCa at 2007-7-12 23:07:26 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...