This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
anita prat wrote: But before such an action is triggered, the State and Country names from the dropdown need to be selected which will be applied to all the actions . I have tried using hidden values for these state and country values in the dropdown but I am unable to understand how to submit .
I am not getting the question. The dropdown values get submitted automatically with the form. There is no need to have them as separate parameters to submit. Is it that the drop-downs are in a form different than the one that is getting submitted?
No, the two country and state fields are part of the same form which is renedered upon successful login. They have to be available throughtout the session , the actions that get triggered from the top nav on this form need these values. This is what I have now:
HomeForm : countryName,stateName - String values
countryList,stateList - arrayLists
In LoginAction: execute():
ValueObject vo = new ValueObject();
HomeForm welcomeForm= new HomeForm();
ArrayList<ValueObject> CtryStateLList = DAO.getStateAndCountryList();
Iterator it = CtryStateList.iterator();
Thanks , Rahul. I implemented what you mentioned in your post, now the issue is when i click the target action from the top nav tab to which the two hidden values on the homepage are submitted to, I get a null pointer in that target action when I try to get these values from the request.
In my target action:
String option = request.getparameter("option");
String state = request.getParameter("state");
these values are null. how do I store these values in the request in that jsp. Because in the input tag the value is not specified, it is blank.