I have spent some more time tracing this problem and I see what the problem
is - the attribute "value" does not acquire the value I'm attempting to
assign it.. To recap, in my action I have

private List<Integer> keys;
public List<Integer> getKeys() { return keys; }
public void setKays(List<Integer> keys) { this.keys = keys; }

and in the JSP fragment in question is like this:

          <c:forEach var="qa" items="${actionBean.user.aMap}"
varStatus="loop">

                <s:hidden name="keys[${loop.index}]">"${qa.key}"</s:hidden>

                   ${qa.key} - ${loop.index}<br>

                ${qa.value.question}
                <s:select name="answer">
                    <s:options-collection collection="${qa.value.aList}"/>
                </s:select>
            </c:forEach>


This fragment yields this source below for the trivial case with only one
element in the map actionBean.user.aMap. The attribute "value" is expected
to be "2" but is empty string. I tried to putting the ${qa.key} in the body
of <s:hidden> but to no avail. Any ideas?


                <input name="keys[0]" type="hidden" value="" />


                2 - 0<br>

                The question text is ______.
                <select name="answer">
                    <option value="3">3</option><option
value="4">4</option><option value="5">5</option><option
value="6">6</option><option value="7">7</option><option
value="8">8</option><option value="9">9</option><option
value="10">10</option><option value="11">11</option><option
value="12">12</option><option value="13">13</option><option
value="14">14</option><option value="15+">15+</option>

                </select>
                <br>




2010-07-19 21:09:45 [WARN] [net.sourceforge.stripes.util.Log] - Unhandled
exception caught by the Stripes default exception handler.

javax.servlet.ServletException: Index: 0, Size: 0

    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:166)

    at
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:247)

    at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)

    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)

    at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)

    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:771)

    at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:679)

    at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:539)

    at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)

    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3357)

    at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)

    at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)

    at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1455)

    at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:115)

    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)

    at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)

    at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)

    at
com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)

    at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
    at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

On 19 July 2010 17:28, Aaron Stromas <passog...@gmail.com> wrote:

> Greetings,
>
> Can someone help me understand what am I missing about indexed properties?
> I have a rather odd legacy hash with integer keys. The values in the hash
> are beans with a fair number of properties, including a list, which is used
> for the HTML select element.
>
> <c:forEach var="qa" items="${actionBean.user.aMap}" varStatus="status">
>
>                 <s:select name="answer">
>                     <s:options-collection collection="${qa.value.aList}"/>
>                 </s:select>
>
>                 <s:hidden name="keys[${status.index}]" value="${qa.key}"/>
>  </c:forEach>
>
> In addition to the selected value I need to capture the key of the map
> (qa.key), so I have created a List<String> property named "keys" in the
> action bean, hoping it would use the indexed properties to bind to the hash
> key values but it does not.
> I even tried <s:hidden name="${actionBean.keys[${status.index}]}"
> value="${qa.key}"/> but it did not help.
>
> Also, when I declare the "answer" property as String[], it is bound, but if
> I declare it as List<String> it does not!  Why is that?
> Thanks in advance!
>
> -a
> --
> Aaron Stromas
> Mobile: +1 703 203 9169
>
>


-- 
Aaron Stromas
Mobile: +1 703 203 9169
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to