Dave,

Thank you for responding to me both times. However, I have tried both
declarations and I get the same result.

<form-property name="selectedAttributes" type="java.lang.String[]" />
and
<form-property name="selectedAttributes" type="java.lang.String" />

I know that Ljava.lang.String is an array of strings, however, either
it is being processed wrong, or I do not know how to process the data
correctly. Lets say that the ListBox has elements: 1, 2, 3, 4, 5; and
I select 2, 3, and 4. Given the code that I have shown in my previous
posts I receive the output:  Ljava.lang.String;@57125f92, instead of
what I want which I believe should be the value "2", since I am
referencing attr[0]. Hopefully I have described my issue better and
that we can work together to find a solution. Thank you and anyone
else in advance.

Adrian

---------- Forwarded message ----------
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Date: Wed, 21 Nov 2007 08:03:52 -0800 (PST)
Subject: Re: Help with html:select multiple="true"
Please see my response to your first message.

Ljava.lang.String *is* an array of strings, and it
wasn't clear to me why you didn't declare your dyna
form field to be an array of strings (you had it as a
single string).

d.

--- Adrian Marrero <[EMAIL PROTECTED]> wrote:

> Hi,
>
> Sorry about reposting this topic and forgetting to
> put a subject the first time.
>
> Here is my issue.
>
> Goal:
> I would like to be able to select multiple fields
> from the drop down
> box, retrieve them in my servlet, and use them
> elsewhere.
>
> I have tried using html:select multiple="true" and I
> continue to
> receive an output
> that I am not expecting and I do not know what I
> need to fix to get what I need.
>
> Problem:
> When I retrieve the String [] in my servlet and I
> view its
> information; what I have
> is a String [] of length = 1 and of type
> "Ljava.lang.String",
> regardless of how many
> selections I make in the drop down box.
>
>
> customProperties.jsp
>
--------------------------------------------------------
> <html:select name="customData"
> property="selectedAttributes"
> multiple="true" size="5">
>  <html:options name="moduleProps"
> property="dropDown"
> labelName="moduleProps" labelProperty="dropDown"/>
> </html:select>
>
> CustomData.java (Bean in use)
> ---------------------------------------------
> private String [] selectedAttributes;
>
> public String [] getSelectedAttributes()
> { return this.selectedAttributes;}
>
> public void setSelectedAttributes(String []
> selectedAttributes)
> { this.selectedAttributes = selectedAttributes; }
>
> CustomizeAction.java (Servlet)
> ----------------------------------------------
> CustomData cd = (CustomData)form;
> String [] attr = cd.getSelectedAttributes();
> out.println("Selected attributes size: " +
> attr.length);
> out.println("Selected attributes data: " + attr[0]);
>
> output
> ----------------------------------------------
> Selected attributes size: 1
> Selected attributes data:
> [Ljava.lang.String;@18170f98
>
> Does anyone have an idea of what I can do to
> retrieve in the servlet
> the values that I selected from the drop down menu
> on the jsp page?
> Any suggestions would be really appreciated. Thank
> you in advance for
> you help.
>
> Adrian

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

Reply via email to