You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Donald Rosengartner <du...@hotmail.com> on 2007/11/04 14:16:54 UTC

LazyValidatorForm not accepting multiple selects

I recently joined a team using struts 1.3.8 and LazyValidatorForm. I can not seem to get the following html:select to work. I have tried modifying the datatype of the form bean property(ArrayList, String[], etc). String[] made the first of my selections' values available in the Action, but no other selections posted. I have javascript in place to make these selected options "selected", so I'm sure the post is not the issue. Switching to the classic ActionForm, all values become available with no JSP/javascript changes. My code follows:
<bean:define id="teams" name="DMAForm" property="teamCollection" type="java.util.List"></bean:define>
<html:select property="schdTrnmtGamesSelected" multiple="true" size="10" styleId="selectedTeams">
<html:options collection="teams" property="teamId" labelProperty="teamName" /> </html:select> Classic Struts accessor - String[] selectedTeams = dmaForm.getSchdTrnmtGamesSelected();with LazyValidatorForm -String[] selectedTeams = (String[]) dmaUserForm.get("schdTrnmtGamesSelected");// this gives ClassCastException, but the next is fine at runtimeString selectedTeams = (String) dmaUserForm.get("schdTrnmtGamesSelected");// defeats the purpose, as I need all selections that I intended to post
I also tried to access as indexed property of the map, such as String selectedTeam1 = (String) dmaUserForm.get("schdTrnmtGamesSelected", 0);String selectedTeam2 = (String) dmaUserForm.get("schdTrnmtGamesSelected", 1);The zeroeth index returns the same value as that above without the index[0], but subsequent values of the index are not populated in the form.
Searching the archives for information on this, I find that String[] is the correct datatype, but little if any information about mutiple=true concurrently used with LazyValidatorForm.I need to get this working as I have a tiles header that requires a lazyValidatorForm in scope. I have a workaround which forwards to the init method(as if to read the calling page for the first time), however I have other pages that are top-level and are broken until I find a fix.Thanks in advance for suggestions givenD. Duane RosengartnerSogeti - Dallas Unit
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline