I am trying to achieve the following:
There is a jsp page with 3 fields. 2 of them are drop-down select fields (Target Audience & User). User field is initially disabled. Only if the Target Audience field has a pre-defined value selected will the User field become enabled. But the moment it is enabled, it should dynamically fetch a list of all users defined in the system from the database and display it in the dropdown. Finally, this entire jsp has to be submitted as a Struts form and invoke a Struts action.
Or is there a better method?
My application is using Struts 1.
Your ideas and suggestions will be of great help. Thanks!!!
Basu wrote: it should dynamically fetch a list of all users defined in the system from the database and display it in the dropdown.
Take a look at JQuery Ajax .
Do post back for any further queries.
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
When I change the drop-down, and select Individual User, the decideEnabling() function is getting called. Inside that function, the alert "hi...after action" is also getting executed. But the document.forms.submit() doesn't seem to be working. An SOP statement in the execute() method of the action class is not getting printed, which means the action isn't getting called. Even the second alert is not executing. But I am not getting any errors either.
I find this strange because a document.forms.submit() works in another place in my application perfectly fine.
Let me Introduce you a little to AJAX. What AJAX does is to make a request to your servlet or your struts action without submitting the current form.
Moreover, AJAX uses less overhead as much lesser data is received and sent.
I previously introduced you to <s:doubleselect> as in that way you won't have to be bothered about AJAX as it makes this easier.
Hi Lalit....thanks a lot for your post. The tag you named, is it a struts 2 tag? I followed your link and the documentation looks like its for struts 2 (also..the s prefix)
I'm using Struts 1.x for this. Any equivalent in 1.x version for this?