Win a copy of Modern frontends with htmx this week in the Spring forum!

Sivarama Raju

Greenhorn
+ Follow
since May 22, 2008
Merit badge: grant badges
For More
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 Sivarama Raju

JSF
<?xml version="1.0" encoding="ISO-8859-1" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" version="2.0">

<ui:composition>
<h:form id="CalcForm">
<h:panelGrid columns="3">
<h:outputLabel value="First Number" for="firstNumber" />
<h:inputText id="firstNumber" value="#{CalcBean.firstNumber}"
required="true" />
<h:message for="firstNumber" />

<h:outputLabel value="Second Number" for="secondNumber" />
<h:inputText id="secondNumber" value="#{CalcBean.secondNumber}"
required="true" />
<h:message for="secondNumber" />
</h:panelGrid>
<h:panelGroup>

<h:selectOneMenu value="#{CalcBean.selectChoice}">

<f:selectItem itemLabel="Add" itemValue="SubmitAdd" />
<f:selectItem itemLabel="Multiply" itemValue="SubmitMultiply" />
<f:selectItem itemLabel="Subtract" itemValue="SubmitDivide" />
<f:selectItem itemLabel="Divide" itemValue="SubmitDivide"/>

</h:selectOneMenu>

<h:commandButton action="#{CalcBean.selectValue}" value="Submit"></h:commandButton>


</h:panelGroup>
</h:form>
</ui:composition>
</jsp:root>

Hi Arun
this is my dropdown.jspx page
15 years ago
JSF
I tried a lot with the Dropdown, but couldn't give action to the submit button, for the items in dropdown. This is my code:

JSF:
<h:selectOneMenu value="#{CalcBean.selectValue}">
<f:selectItem itemLabel="Add" itemValue="SubmitAdd" />
<f:selectItem itemLabel="Multiply"itemValue="SubmitMultiply" />
<f:selectItem itemLabel="Subtract" itemValue="SubmitDivide" />
<f:selectItem itemLabel="Divide" itemValue="SubmitDivide"/>
</h:selectOneMenu>

<h:commandButton action="#{CalcBean.selectChoice}" "Submit"></h:commandButton>

Backing bean:

public String selectChoice() {
String returnVal = "";
if (selectValue == "SubmitAdd") {
returnVal = add();
} else if (selectValue == "SubmitMultiply") {
returnVal = multiply();
} else if (selectValue == "SubmitSutract") {
returnVal = subtract();
} else if (selectValue == "SubmitDivide") {
returnVal = divide();
}
return returnVal;
}


public String getSelectChoice() {
return selectChoice;
}

public void setSelectValue(String aSelectValue) {
this.selectValue = aSelectValue;
}

public String getSelectValue() {
return selectValue;
}


Hey i am new friends, might have done some silly mistakes.

Thanks and regards,
siva
15 years ago
JSF
JSF
hi Arun,

I tried a lot with the Dropdown, but couldn't give action to the submit button, for the items in dropdown. This is my code:

JSF:
<h:selectOneMenu value="#{CalcBean.selectValue}">
<f:selectItem itemLabel="Add" itemValue="SubmitAdd" />
<f:selectItem itemLabel="Multiply"itemValue="SubmitMultiply" />
<f:selectItem itemLabel="Subtract" itemValue="SubmitDivide" />
<f:selectItem itemLabel="Divide" itemValue="SubmitDivide"/>
</h:selectOneMenu>

<h:commandButton action="#{CalcBean.selectChoice}" "Submit"></h:commandButton>

Backing bean:

public String selectChoice() {
String returnVal = "";
if (selectValue == "SubmitAdd") {
returnVal = add();
} else if (selectValue == "SubmitMultiply") {
returnVal = multiply();
} else if (selectValue == "SubmitSutract") {
returnVal = subtract();
} else if (selectValue == "SubmitDivide") {
returnVal = divide();
}
return returnVal;
}


public String getSelectChoice() {
return selectChoice;
}

public void setSelectValue(String aSelectValue) {
this.selectValue = aSelectValue;
}

public String getSelectValue() {
return selectValue;
}


Hey i am new yaar, might have dont some silly mistakes.

Thanks and regards,
siva
[ May 22, 2008: Message edited by: Sivarama Raju ]
15 years ago
JSF
JSF
Hey, thanks Tim.
15 years ago
JSF
JSF
Hi Arun,

Thanks a lot for you reply friend. I will try using <h:selectOneMenu>.
I will inform you about my progress. Thanks a lot.

Thanks and regards,
siva
15 years ago
JSF
JSF
Hi friends,

Can any one please guide me to create a dropdown using JSF ?

Thanks and regards,
15 years ago
JSF