aspose file tools*
The moose likes Struts and the fly likes How to retreive multiple select in s:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retreive multiple select in s:select" Watch "How to retreive multiple select in s:select" New topic
Author

How to retreive multiple select in s:select

Jay Abrahm
Ranch Hand

Joined: May 28, 2008
Posts: 183

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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: May 28, 2008
Posts: 183
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

Joined: May 28, 2008
Posts: 183
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.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retreive multiple select in s:select