John, sorry for not getting back sooner.  I've been in meetings since
lunch.  I'll see what I can work up tonight.


--
James Mitchell
Web Developer/Struts Evangelist
http://jakarta.apache.org/struts/

"People demand freedom of speech to make up for the freedom of thought
which they avoid."
    - Soren Aabye Kierkegaard (1813-1855)




> -----Original Message-----
> From: John Devine [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 04, 2003 2:41 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Accepting arrays as values in mapped-backed ActionForms
> 
> 
> Sure I'd love to see an example!
> 
> But like I said, I ended up using the scriptlets for iteration because
> within the iteration of "storyList" I call a tile like so:
> 
>   <td>
> <tile:insert page="/WEB-INF/tilestemplates/storyDetailwithBlurb.jsp" >
>  <tile:put name="story" beanName="story" />
>  <tile:put name="counter" beanName="counter" />
> </tile:insert>
>   </td>
> 
> and I couldn't get the tile to be called properly when it was 
> within an
> <logic:iterate> tag. (and I haven't boned up on the nested tags enough
> to be comfortable with them yet).
> 
> If you have an example of naming the property of the multibox 
> to accept
> a set of options for each story in the iteration, that's where my real
> problem lies right now. The way I have it now works fine for 
> <html:text>
> and single parameter inputs, but I can't get it to work for multiple
> parameter inputs.
> 
> Thanks,
> 
> John
> 
> 
> -----Original Message-----
> From: James Mitchell [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 04, 2003 1:28 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Accepting arrays as values in mapped-backed ActionForms
> 
> You can accomplish all of this with tags and elimate your scriptlets.
> 
> I have something close to that, let me know if you want an example.
> 
> 
> --
> James Mitchell
> Web Developer/Struts Evangelist
> http://jakarta.apache.org/struts/
> 
> "People demand freedom of speech to make up for the freedom of thought
> which they avoid."
>     - Soren Aabye Kierkegaard (1813-1855)
> 
> 
> 
> 
> > -----Original Message-----
> > From: John Devine [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, March 04, 2003 1:52 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Accepting arrays as values in mapped-backed ActionForms
> > 
> > 
> > Hello Struts community!
> > 
> > No one's picked up on this thread and I just wonder whether it's a
> > stupid or unclear question or whether it's just not of interest. 
> > 
> > If the question's been answered before, could someone let 
> me know and
> > I'll go back to searching lists. I didn't find any answers earlier.
> > 
> > Basically what I'm trying to is set up a form that will 
> > contain a Map of
> > String arrays. At this point, when Struts populates the Map, 
> > it assumes
> > the map elements will be plain strings. Does anyone know of a way to
> > tell it that the members of the map should be populated as arrays
> > (because multiple request parameters will have the same name).
> > 
> > Thanks in advance for any response,
> > 
> > John Devine
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From: John Devine [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, March 03, 2003 5:10 PM
> > To: [EMAIL PROTECTED]
> > Subject: Accepting arrays as values in mapped-backed ActionForms
> > 
> > Does anyone know how to specify that the value of the HashMap in a
> > mapped-backed ActionForm should be an array of Strings rather 
> > than just
> > a single String?
> > 
> > I'm having a problem in trying to set up a page of several rows of
> > indexed multi-boxes:
> > 
> > I have a regular action form that includes:
> > 
> >    public Map existingGroups = new HashMap();
> > 
> >    public Map getExistingGroups(){
> >       return existingGroups;
> >    }
> > 
> >    public void setExistingGroups(Map map){
> >       this.existingGroups = map;
> >    }
> > 
> > On my JSP, I include several different rows of multiboxes, 
> and I want
> > the user to be able to choose different groups for each object:
> > 
> > <%
> > List storyList = searchBean.getList();
> > int counter = 1; 
> > for (Iterator i = storyList.iterator(); i.hasNext(); counter++ ) { 
> >    Story story = (Story)i.next(); 
> >    pageContext.setAttribute("story", story); 
> >    pageContext.setAttribute("counter", new Integer(counter)); 
> > %>
> > 
> > <tr>
> >   <td>
> >    <bean:write name="story" property="title" />
> >   </td>
> > <logic:iterate id="group" name="submitToGroupForm"
> > property="availableGroups" type="com.rd.Group" >
> >   <td>
> >    <html:multibox 
> > property='<%="existingGroups("+story.getId()+")"%>'  >
> >     <bean:write name="group" property="id" />
> >    </html:multibox>
> >     <bean:write name="group" property="name" />
> >   </td>
> > </logic:iterate>
> > </tr>
> > 
> > <% } %>
> > 
> > (Oh, and I use the scriptlet iteration because there's a tile being
> > called within that loop that I edited out for readability.)
> > 
> > What happens is that value of "existingGroups(primaryKey1)" 
> > is a String
> > instead of an array of Strings. So that if I try to cast it 
> > to String[],
> > I get a ClassCastException.
> > 
> > Is this a limitation of using maps in forms, or is there a 
> > way to return
> > arrays of strings as entries of the Map on your ActionForm?
> > 
> > Thanks,
> > 
> > John
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to