Updating Multiple Drop-Down Lists in AjaxTags
- by Berin
I'm using AjaxTags as a defined set of JSP tags to facilitate AJAX programming, saving me from some heavy lifting. The project is in trial mode, so I may not adopt the technology and write my own solution.
Here's what I'm running into (code abbreviated)
I have a drop-down list that defines an item that populates numerous other drop-down lists.
<form>
...
<select id="item1" name="item1">
<c:forEach items="${list1}" var="item">
<option value="${item}">${item}</option>
</c:forEach>
</select>
<select id="item2" name="items2"></select>
<select id="item3" name="items3"></select>
...
</form>
<ajax:select
source="item1"
target="item2"
baseUrl="${pageContext.request.contextPath}/doAction.view"
parameters="action1 = {item}" />
<ajax:select
source="item1"
target="item3"
baseUrl="${pageContext.request.contextPath}/doAction.view"
parameters="action2 = {item}" />
The code above works with my back-end, initiating a call to a servlet class that is listening for calls, parses the parameter and takes action based upon the name of the parameter passed. The problem comes from adding the second ajax:select tag above. An action in drop-down "item 1" only causes "item 3" to be populated with new values. What I want is for an action in "item 1" to populate "item 2" and "item 3" (and 4, 5, 6...).
Has anyone else used AjaxTags (ajaxtags.sourceforge.net) and solved a similar solution?
Environment Details: Tomcat 5.5.27, Spring 2.0.8, Struts 1.2.9, Java 6