Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

passing collection in JSTL html:select onChange event javascript

843838Aug 23 2005 — edited Aug 23 2005
I'm trying to pass an object from the form to a javascript function to change text box values when the value of a select field is changed.

On the jsp page, I have access to the collection called rows.

I also have an html:select field that I need to use the onChange event to change other fields on the page. I can certainly call a javascript function on the onChange with no problem. But I need to take it one step further. I need to send the javascript function the collection called rows, so I can set other fields' values on the jsp page to the values of the selected row.

This (or some facimile) is what I want to do:
<html:select name="currentForm" property="value(id)" onChange="fillUomForm(this.form,this,rows);">
  <c:forEach var="row" items="${rows}">
      <c:choose>
           <c:when test='${row.id == currentForm.stringValues["id"]}'>
                <option value="<c:out value='${row.id}'/>" selected>
                     <c:out value="${row.id}"/>
                </option>
           </c:when>
           <c:otherwise>
                 <option value="<c:out value='${row.id}'/>">
                    <c:out value="${row.id}"/>
                 </option>
           </c:otherwise>
       </c:choose>
    </c:forEach>
</html:select>
Of course, rows is not recognized when I try to run this.
I have tried replacing rows with
<c:out value='${rows}'/> but that did not work.

How can I do this?
thanks,
Walter
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2005
Added on Aug 23 2005
1 comment
1,606 views