0

This question is on Struts2 jquery plugin. While loading a JSP be default I am loading one dropdown list values and the second dropdown values are loaded based on selection of first dropdown. When the second dropdown value is selected an onChange event get executed and the page is getting refreshed. When the page is refreshing the First dropdown is getting called again! Is there anyway to avoid the second time execution of default loading of firstdropdown and also need to hold the selected values for both the submitted dropdown values of the JSP?

Note: First dropdown and second dropdowns are evaluated in SampleAction.java and onChange event executes LoadAction.java

Please let me know if you require further details!

Thanks

1 Answers1

0
  1. An option from the first dropdown is selected

  2. Second dropdown is filled accordingly and then a value is selected

  3. Instead of page-refresh, you can submit a form passing the values of both select tags

  4. Now you get the selected values in your action and then you can show the same page but with prefilled values. This time when the page loads, the first select box by default shows the same previously selected value.

  5. For the second select to show the previously selected value, you'll have to write some javascript code which will select the previously selected value.

coding_idiot
  • 13,526
  • 10
  • 65
  • 116
  • @ coding_idiot, Thanks for your reply. I am able to achieve what you have said and the main issue of calling the method of JSON needs to be solved yet. Thanks for your help. – user2927771 Oct 29 '13 at 10:36
  • if your lists are not too big, [struts2 doubleselect](http://struts.apache.org/release/2.3.x/docs/doubleselect.html) is a good alternative – coding_idiot Oct 29 '13 at 10:39