Naeem Malik

Greenhorn
+ Follow
since Oct 25, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Naeem Malik

del1.jsp

<h:selectOneMenu value="#{del1.selectedOption}" onchange="submit();"
valueChangeListener="#{del1.selectedOptionChanged}">
<f:selectItem itemLabel="Vet ikke" itemValue="Vet ikke"/>
<f:selectItem itemLabel="Mann" itemValue="Mann"/>
<f:selectItem itemLabel="Kvinne" itemValue="Kvinne"/>
</h:selectOneMenu>

Personnr.java

private String selectedOption;

public String getSelectedOption()
{
return selectedOption;
}

public void setSelectedOption(String selectedOption)
{
this.selectedOption = selectedOption;
}

public void selectedOptionChanged(ValueChangeEvent event)
{
selectedOption = (String)event.getNewValue();
if(selectedOption.equals("Vet ikke"))
activateOtherInput = true;
else
activateOtherInput = false;
FacesContext context = FacesContext.getCurrentInstance();

context.renderResponse();
}

faces-config.xml
<faces-config>
<managed-bean>
<managed-bean-name>del1</managed-bean-name>
<managed-bean-class>Personnr</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>


where is the problem? i want to access value that i have selected in combo box?
13 years ago
JSF