- This topic has 4 replies, 2 voices, and was last updated 19 years, 2 months ago by Ollie.
-
AuthorPosts
-
OllieMemberHi there,
I have defined the following seöect box in a jsp. In LogginForm a have created getters and setters for selectedItem.
html:select name=”ShoppingForm” property=”selectedItem”>
<html:option value=”1″>eggs
</html:option>
<html:option value=”2″>bacon</html:option>
<html:option value=”3″>towels</html:option>
<html:option value=”3″>cleaners</html:option>
</html:select>However when I cannot call on selectedItem in my Action class. Is property the wrong attribute?
if(selectedItem1.equalsIgnoreCase(“eggs”))Cheers
Riyad KallaMemberMoving to OT > Soft Dev.
Please post the code for ShoppingForm.java
OllieMemberHere is the code:
public class ShoppingForm extends BaseForm{
protected String selectedItem;
protected String supermarket;
protected String town;
protected int price;static final long serialVersionUID = 99999999999999L;
public String getSelectedItem() {
return selectedItem;
}public void setSelectedItem(String selectedItem) {
this.selectedItem = selectedItem;
}public String getSupermarket() {
return supermarket;
}
public void setSupermarket(String supermarket) {
this.supermarket = supermarket;
}
public String getTown() {
return town;
}
public void setTown (String town) {
this.town = town;
}
public int getPrice() {
return price;
}public void setPrice(int price) {
this.price = price;
}}
Greetings
Riyad KallaMemberOk that looks good, what is the error exactly?
OllieMemberHi, sorry for responding so late I’ve solved the problem I think it was just that I named the property incorrectly – thanks anyway. Sorry – would have responded earlier but I didn’t realise this was the side you were referring to.
Cheers. -
AuthorPosts