dropdown box in jsf

Ads
 

dropdown box in jsf

View Answers

November 18, 2008 at 3:22 AM

Hi friend,

For solving the problem some points to be remember :

For example You select a country then its corresponding city selected.

Use attribute "valueChangeListener" call the method "processValueChange1"

on select the country.

"You add the code in the form part"
<tr>
<h:selectOneMenu id="locationcountry" value="#{beanclass.locationcountry}" valueChangeListener="#{beanclass.processValueChange1}" immediate="true" onchange="this.form.submit()" styleClass="inputbox" style="width:150px">
<s:selectItems value="#{beanclass.countryList}" var="country" label="#{country.country}" itemValue="#{country.id}"/>
</h:selectOneMenu>
</tr>

<tr>
<h:selectOneMenu id="locationcity" value="#{postjobHome.instance.locationcity}" styleClass="inputbox" style="width:150px">
<s:selectItems value="#{previewjob.cityList}" var="city" label="#{city.cityname}" itemValue="#{city.id}"/>
</h:selectOneMenu>
</tr>

"You add the code in the beanclass part"
List countryList= new ArrayList();
List cityList= new ArrayList();


public List getCountryList(){
findCountries();

return countryList;
}

public List getCityList(){
if(cityList.size() == 0){

findCities("1");
}

return cityList;
}


public void processValueChange1(ValueChangeEvent vce){
Integer countryid = (Integer) vce.getNewValue();

findCities(countryid.toString());


}


public void findCities(String countryid) {

List allCityList = "Array List of City"


ListIterator li = allCityList.listIterator();
cityList.clear();
while(li.hasNext()){
City c = (City)li.next();
System.out.println("c.getCityname()" + c.getCityname());
cityList.add(c);
}
}

For more information on JSF visit to :

http://www.roseindia.net/jsf/

http://www.roseindia.net/jsf/selectOneMenu.shtml

http://www.roseindia.net/jsf/valueChangeListener.shtml

http://www.roseindia.net/software-tutorials/detail/19882

Thanks

Ads









Related Tutorials/Questions & Answers:
dropdown box in jsf - Java Server Faces Questions
dropdown box in jsf  Hi friends, AssigningJob... in dropdown box
dropdown box
dropdown box  i need to have country,state and city in drop down box using ajax and use db2 database   Have a look at the following link: JSP dependent dropdown
Advertisements
dropdown list in jsf
dropdown list in jsf  I want to add a list box to display the country name from the lists on all countries.When I select for e.g India then in the second list box it will display the states related to India only and the flow
populate dropdown box
item in dropdown menu is 10 then the second dropdown box should contain values...populate dropdown box  hi, Is there any ways in which i can populate my dropdown menu with values from 1 to n (n = the value stored in database
store dropdown box values in database server
store dropdown box values in database server  how to store dropdown box values in database server in jsp
populating one dropdown box depending on the value of other using jsp
populating one dropdown box depending on the value of other using jsp  HI i have scenario i need to populating one dropdown box depending... in dropdown box one after the other CREATE TABLE CITY_MASTER( CITYID BIGINT
jquery dependency dropdown box in spring hibernate my sql
jquery dependency dropdown box in spring hibernate my sql  Hi Friends, Can you please provide me the code for dynamic drop down box using jquery... then the related states has to display it's corresponding drop down box, those values has
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct... in dropdown box.... so when i login i all the three username,password and dropdown box........ but in the drop down box ... i need to get the values from backend
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct...  my project has login in whic i should select the company name in dropdown box.... so when i login i all the three username,password and dropdown box
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core java  hi., i just need to correct my codes.somebody help me to clear the error to bring a right of codes to execute.Thanks in advance. //first page
dropdown
dropdown  how to hide textbox field when i deselect from select dropdown
dropdown
dropdown  I have a dropdown having 2 options-"Open"& "closed".When i select "open" option the related rows of data are retrieved from database and same with the other option.My database is Mysql and coding in PHP
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
Dynamically display values in dropdown box and then show the selected values... this code it is adding one more value to the dropdown box and showing as selected. so if I have 5 values in the dropdown this selected one is added as 6th values
JSF
JSF  What is JSF
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB   Hello... in the list box. Somehow I can just show only one as selected but not multiple records
JSF
JSF  In what way JSF makes the difference between Applets?? After reading this article I understood instead of using Request and response, we... and embed that into applets also rite.. Do u mean JSF also does the same internally
JSF code
need jsf code that will populate combo box values from the database  Hi, i'm new on JSf,I need jsf code that will populate combo box values from the database when the form runs
creating dropdown lists in jsp
creating dropdown lists in jsp  i want to create two dropdown list which are dependent that is the first box choice have to evaluate the second boxs options
checkbox with dropdown listbox in jsp
checkbox with dropdown listbox in jsp  i loaded the the data into the drop down listbox in jsp from access database.now i have to add a check box,if it checked means dropdownlist box carryout the data's,else it should
JSF architecture
JSF architecture  What is JSF architecture
Ajax Dropdown
Ajax Dropdown  hi I have One Dropdown that contains 2 options assume A and B,if i select A option then samepage one more Dropdown is their it should display values in german language using DWRUtil Parameter values in ajax. Only
dropdown cacheing
dropdown cacheing   I need code to create cache for load drop down list from db in struts1 example
binding data with textbox on dropdown click
binding data with textbox on dropdown click  Hello friends,Divyesh here. i have jsp page and i would like to bind data with text box on dropdown click. in dropdown employee id are load.and when we select perticular id than how
jsf attribute
jsf attribute  What is the different between value and binding attribute of jsf
Advantages of JSF
Advantages of JSF  What are the advantages of JSF
Implementations of JSF
Implementations of JSF  What are the available implementations of JSF
DropDown Menu
DropDown Menu  Hello, i have a program that can view,add,delete... me draw to your my mind my program.. in my homepage which i have a dropdown... is the problem.. for example; if i select page 1 in my dropdown menu, and click
JSF framework
JSF framework  hi Can I use Jdeveloper to learn JSF framework? thanks Sangeetha
jsf session
jsf session  How to maintain session in jsf login application?   Please visit the following links: http://www.roseindia.net/jsf/richfaces/creating-managed-bean.shtml http://www.roseindia.net/jsf/RememberMeLogin.shtml
JSF Tutorial
JSF Tutorial  I am novice to JSF Programming. And want to learn the Java Server Faces (JSF) technology online. So, could you please list down few helpful JSF Tutorials. Also, which is the latest version of Java Server Faces (JSF
jsf session
jsf session  How to maintain session in jsf login application?   Please visit the following links: http://www.roseindia.net/jsf/richfaces/creating-managed-bean.shtml http://www.roseindia.net/jsf/RememberMeLogin.shtml

Ads