tags:

views:

1326

answers:

7

this is my jsp:

<s:form action="InsertSurvey">
        <table>
            <tr>
                <td> ID Survey: </td><td><s:textfield name="SurveyValues.survey.idtextsurvey"/> </td>
                <td> Tipo Survey: </td><td><s:select list="typeSurvey"/> </td>

            </tr>
        </table>
    </s:form>

and this is my action without get/set

public class InsertSurveyAction extends ActionSupport implements Preparable {

protected SurveyValues surveyValues;
protected List typeSurvey;
protected String typeSurveySelected;

public InsertSurveyAction() {

}

@Override
public String execute() throws Exception {
  return SUCCESS;
}

public void prepare() throws Exception {
    typeSurvey = new ArrayList();
    typeSurvey.add("Multi");
    typeSurvey.add("Singolo");
}

Why I have this problem? *

tag 'select', field 'list': The requested list key 'typeSurvey' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]

I have the last version of struts2.

A: 

Hi Luigi !

Can you post your struts.xml declaring your action mapping ? I tried your code it works fine for me.

Oliver Clément
A: 
<struts>
<constant name="struts.devMode" value="true"/>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />



<package name="default"  extends="struts-default">

    <action name="InsertSurvey" class="it.survey.actions.InsertSurveyAction">
        <result name="success">/InsertSurvey_step1.jsp</result>
    </action>

</package>

Luigi 1982
A: 

Hi !

The thing is you did not declare a getter for the typeSurvey List, try with public List<String> getTypeSurvey() { return typeSurvey; }

Oliver Clément
A: 

I just added the gettes and setters.. I don't write on code example, but there are... The problem persist..

Luigi 1982
A: 

When are you calling prepare() ? I think you need to initialize your array before calling execute()

Arscek
A: 

El problema es que el tag <s:form action="InsertSurvey"> solo se ejecuta en forma explicita por ejemplo despues de un submit, en tu caso el action no se ha ejecutado y por tanto los valores de typeSurvey no estan disponibles.

The problem is that the tag <s:form action="InsertSurvey"> only runs on explicitly for example after a submit, in your case the action was not executed and therefore typeSurvey values are not available.

Miguel Angel
A: 

Are your problem ok?

me too. i see a both problem.

mail to [email protected] if it's ok

very thank u

lrwin