Hi. I'm working with Struts 1.2.7, J2EE and Jacarta Tomcat 5.5.9.
Im trying to show a select element in a jsp to choose a question from a list of LabelValueBeans
identifier value by it's label, and put the label in a property 'question' of type String in a
DynaActionForm (to send to an action, of course).
For instance, below in my code the label will be "Question.Winner", I want to put the value '1'
in the property 'question' of my 'inserBetSortForm'.
In my action::
List questions= new ArrayList();
questions.add(new org.apache.struts.util.LabelValueBean("Question.Winner","1"));
questions.add(new org.apache.struts.util.LabelValueBean("Question.FisrGoal","2"));
questions.add(new org.apache.struts.util.LabelValueBean("Question.BestPlayer","3"));
request.setAttribute("questions",questions);
In my jsp::
html:form xmlns=" xmlns:jsp=" xmlns:fmt=" xmlns:c=" xmlns:html=" action="InsertBetSort.do" focus="question">
...
<html:select property="question" size="1">
<htmlptions>
collection="${requestScope.questions}" property="value" labelProperty="label"
</htmlptions>
</html:select>
In my Struts Config::
<form-bean name="insertBetSortForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="eventIdentifier" type="java.lang.Long"/>
<form-property name="question" type="java.lang.String"/>
</form-bean>
...
<action path="/InsertBetSort"
type="betandpray.http.controller.actions.InsertBetSortAction"
name="insertBetSortForm"
scope="request"
input=".EditBetSort"
validate="true">
<set-property property="authenticationRequired" value="true"/>
<set-property property="adminRequired" value="true"/>
<forward name="InsertBetChoice" path="/EditBetChoice.do"/>
</action>
This is the error I get:
ServletException in '/InsertBetSortContent.jspx': Cannot create iterator for DynaActionForm[dynaClass=insertBetSortForm,eventIdentifier=<NULL>,question=]
-----------------
I've tried with the htmlptions tag ant whith the htmlptionsCollection whith the same resutls.
I'm desperated!!! Please help!!
Thanks.
Im trying to show a select element in a jsp to choose a question from a list of LabelValueBeans
identifier value by it's label, and put the label in a property 'question' of type String in a
DynaActionForm (to send to an action, of course).
For instance, below in my code the label will be "Question.Winner", I want to put the value '1'
in the property 'question' of my 'inserBetSortForm'.
In my action::
List questions= new ArrayList();
questions.add(new org.apache.struts.util.LabelValueBean("Question.Winner","1"));
questions.add(new org.apache.struts.util.LabelValueBean("Question.FisrGoal","2"));
questions.add(new org.apache.struts.util.LabelValueBean("Question.BestPlayer","3"));
request.setAttribute("questions",questions);
In my jsp::
html:form xmlns=" xmlns:jsp=" xmlns:fmt=" xmlns:c=" xmlns:html=" action="InsertBetSort.do" focus="question">
...
<html:select property="question" size="1">
<htmlptions>
collection="${requestScope.questions}" property="value" labelProperty="label"
</htmlptions>
</html:select>
In my Struts Config::
<form-bean name="insertBetSortForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="eventIdentifier" type="java.lang.Long"/>
<form-property name="question" type="java.lang.String"/>
</form-bean>
...
<action path="/InsertBetSort"
type="betandpray.http.controller.actions.InsertBetSortAction"
name="insertBetSortForm"
scope="request"
input=".EditBetSort"
validate="true">
<set-property property="authenticationRequired" value="true"/>
<set-property property="adminRequired" value="true"/>
<forward name="InsertBetChoice" path="/EditBetChoice.do"/>
</action>
This is the error I get:
ServletException in '/InsertBetSortContent.jspx': Cannot create iterator for DynaActionForm[dynaClass=insertBetSortForm,eventIdentifier=<NULL>,question=]
-----------------
I've tried with the htmlptions tag ant whith the htmlptionsCollection whith the same resutls.
I'm desperated!!! Please help!!
Thanks.