This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retreive multiple select in s:select

 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I was trying to use the code present in the following URL to get multiple select
https://issues.apache.org/struts/browse/WW-1557?page=com.atlassian.jira.plugin.ext.subversion%3Asubversion-commits-tabpanel

I have the following code in my action class

and the following code in my jsp


But I am not able to get the selected value to be populated in _favouriteCities. Any idea on where I need to be looking ?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd check your assumptions; the code works for me verbatim.

Some things you might check:
- Running the default interceptor stack?
- Submitting to the action you think you are?
- Sure it's not being populated?
 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sure it is called the right action class since I was able to debug the action call. Also, I had checked using inspect to see if it is being populated and it wasn't. Maybe, I'll clean up and start from starch and try it out...

Hold on ..
 
Jay Abrahm
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I am not sure what exactly I have changed but it works now.



Coming to what I was actually trying out. I had two select box side by side and I wanted to obtain the selected options in the action.


I have tried using the following but it gives a null pointer exception
private List selectedList;

During debug I noticed that struts calls the getSelectedList() on load but does not call getFavouriteCities()
but when it returns from the jsp it calls setFavouriteCities(List favouriteCities) which populates the values from the jsp but it does not call setSelectedList(List selectedList) and so it returns a null for the list.

Is it something to do with the syntax definition I have for the select.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic