Hi,
I am having difficulty using struts:
<html:select property="attributes" multiple="true">
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.
Problem:
When I retrieve the String [] in my servlet and I view its contained
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.
Code:
customProperties.jsp
---------------------------------------------
<nested:select name="customData" property="selectedAttributes"
multiple="true" size="5">
<nested:options name="moduleProps" property="dropDown"
labelName="moduleProps" labelProperty="dropDown"/> </nested:select>
---------------------------------------------
struts-config.xml
---------------------------------------------
<form-property name="selectedAttributes" type="java.lang.String" />
---------------------------------------------
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]