I am trying to get multiple items set from a Select box, but my setxxxxxx()
method only gets called once regardless of how many items are selected. Is
this a problem with the .91 implementation I am using? ServletExec? Or was
this passed over? I have included a snippet of code to illustrate this.
OUTPUT:
name 0 = altoids
Counter = 1
<!-- ========= page 1 ========= -->
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM ACTION="./multi2.jsp" METHOD=POST>
<bean name="multi" type="bean.MultiSelect" create="yes" scope="session"
introspect="yes"></bean>
<SELECT name=name size=6 multiple>
<OPTION selected>altoids
<OPTION>refreshing
<OPTION>minty
<OPTION>tasty
</SELECT>
<INPUT id=submit1 name=submit1 type=submit value=Submit>
</FORM>
</BODY>
</HTML>
<!-- ========= end page 1 ========= -->
<!-- ========= page 2 ========= -->
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<bean name="multi" type="bean.MultiSelect" create="yes" scope="session"
introspect="yes"></bean>
<%
String[] names = multi.getNames();
for(int i=0; i<names.length; i++){
out.println("name " + i + " = " + names[i] + "<br>");
}
out.println("<br><br>Counter = " + multi.getCounter());
%>
</FORM>
</BODY>
</HTML>
<!-- ========= end page 2 ========= -->
public class MultiSelect{
private String[] names = new String[20];
private int counter=0;
public MultiSelect(){}
public void setName(String _n){
names[counter] = _n;
counter++;
}
public String[] getNames(){ return names;}
public int getCounter(){ return counter;}
}
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".