On submit checkbox member always null in ActionForm. Checkboxes display checked/unchecked properly o

Discussion in 'Java' started by runescience, Feb 23, 2006.

  1. runescience

    runescience Guest

    Hi all:

    I am populating all fields in the ActionForm, and also populating an
    array of QueryResults from the data base. This bean called QueryResults
    has a field on it called selected. This QueryResults bean lives in the
    Actionform.

    Going out to the jsp, and returning on the execute():
    All the data in the ActionForm, and the nestedbean:query results is
    populated properly except for one field and that is the big problem:

    checkbox member: QueryResults[1-'x'].selected <i>always</i> null in
    ActionForm.

    Here is the code. I dont konw what to do. Any suggestions? Here is my
    code:


    class QueryResultsFormBean extends ActionForm {
    QueryResults[] queryRes;
    String jspFld1;
    String jspFld2;
    String jspFld3;
    ......

    public QueryResults[] getQueryRes() {
    return hatResultsList;
    }
    public void setQueryRes(QueryResults[] queryRes) {
    this.queryRes= queryRes;
    }
    }



    class QueryResults {
    String selected;
    String col1data;
    String col2data;
    String col3data;
    }

    The action execute() is pulling things out of the data base and filling
    in the form data:


    public class QueryInitAction extends Action {
    ........
    QueryResultsFormBean myForm = (QueryResultsFormBean)form;
    db.moveDataHelper(myForm);
    }


    Now when I get to the actual jsp I tried the following:


    <nested:present name="QueryResultsFormBean" property="QueryResults" >
    queryResults are present.
    </nested:present>

    <nested:iterate id="element" name="QueryResultsFormBean"
    property="QueryResults" scope="session">

    <nested:checkbox name="element" property="selected" />
    <nested:write name="element" property="col1data" />
    <nested:write name="element" property="col2data" />
    </nested:iterate>
     
    runescience, Feb 23, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Claire
    Replies:
    3
    Views:
    4,836
    Wendy Smoak
    Mar 2, 2005
  2. soprandi
    Replies:
    0
    Views:
    1,167
    soprandi
    Nov 29, 2006
  3. cteb
    Replies:
    1
    Views:
    5,010
    GArlington
    Oct 13, 2008
  4. Replies:
    1
    Views:
    2,330
  5. Claire
    Replies:
    4
    Views:
    220
    Claire
    Mar 2, 2005
Loading...

Share This Page