http://struts.apache.org/userGuide/building_controller.html#map_action_form_classes
This form is in the QuestionGroupAction class as this: * @struts.action name="mapValueForm" path="/answerQuestionGroup" * parameter="action" scope="request" * * @struts.action name="mapValueForm" path="/openQuestionGroup" * parameter="action" scope="request"
and the form is a part of openQuestionGroup.do.
<html:form action="answerQuestionGroup" method="post" styleId="mapValueForm" >
<c:forEach var="question" items="${requestScope.questionList}">
<h4><c:out value="${question.title}"/> </h4> <i><c:out value="${question.question}"/></i> <div> <%-- Todo: legg til innrykk--%>
<c:forEach var="alternative" items="${question.alternatives}">
<html-el:radio value="${alternative.id}" property="value(${question.id})"/>
<%-- Here I am trying to get the value from mapValueForm --%>
<c:out value="${alternative.text}" /> <br> </c:forEach>
</div> <div class="separator"></div> </c:forEach>
<html:submit styleClass="button" property="action" onclick="bCancel=false"> <bean:message key="button.answerQuestionnaire"/> </html:submit> </html:form>
Everything works except submitting the form. How can I hook the properties from the radio button to the map form?
I found some suggestions to put idName="mapValueForm" (my form name):
<html-el:radio value="${alternative.id}" property="value(${question.id})"/>
to
<html-el:radio value="${alternative.id}" property="value(${question.id})" idName="mapValueForm"/>
which instead of the previous error gives me this one (3 is the id of one of the radiobuttons, fetched from db and set correctly):
javax.servlet.jsp.JspException: No getter method available for property
3 for bean under name mapValueForm
at org.apache.struts.taglib.html.BaseHandlerTag.lookupProperty(BaseHandlerTag.java:927)
at org.apache.struts.taglib.html.RadioTag.serverValue(RadioTag.java:232)
at org.apache.struts.taglib.html.RadioTag.doStartTag(RadioTag.java:212)
at org.apache.strutsel.taglib.html.ELRadioTag.doStartTag(ELRadioTag.java:547)
at org.apache.jsp.WEB_002dINF.pages.questionRenderer_jsp._jspx_meth_html$1el_radio_0(questionRenderer_jsp.java:353)
at org.apache.jsp.WEB_002dINF.pages.questionRenderer_jsp._jspx_meth_c_forEach_1(questionRenderer_jsp.java:314)
at org.apache.jsp.WEB_002dINF.pages.questionRenderer_jsp._jspService(questionRenderer_jsp.java:165)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
at org.apache.jsp.WEB_002dINF.pages.questions_jsp._jspService(questions_jsp.java:45)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapp
I have struggled with this problem a few days now.. Hope anyone who can help me?
I have read some messages on this list concerning almost the same problem. They gave me enough help to get where I am now, but now I am completely stuck, and a bit fed up with struts (or at my incompetence)...
Thanks,
-- Olve S. Hansen
signature.asc
Description: OpenPGP digital signature