facebook

Problem with select box

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #236864 Reply

    Ollie
    Member

    Hi 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

    #236890 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev.

    Please post the code for ShoppingForm.java

    #236925 Reply

    Ollie
    Member

    Here 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

    #236943 Reply

    Riyad Kalla
    Member

    Ok that looks good, what is the error exactly?

    #237490 Reply

    Ollie
    Member

    Hi, 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.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Problem with select box

You must be logged in to post in the forum log in