Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!22g2000prx.googlegroups.com!not-for-mail From: byhesed Newsgroups: comp.lang.java.programmer Subject: Re: Is JavaBeans able to store an array? Date: Thu, 26 May 2011 22:11:27 -0700 (PDT) Organization: http://groups.google.com Lines: 104 Message-ID: <970d7ab8-dc74-4d7c-a486-b934fb3b5d3b@22g2000prx.googlegroups.com> References: <5ec5c70e-03e1-46ae-8ed4-b79ddfef70a0@35g2000prp.googlegroups.com> NNTP-Posting-Host: 220.149.108.146 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1306473087 22845 127.0.0.1 (27 May 2011 05:11:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 27 May 2011 05:11:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 22g2000prx.googlegroups.com; posting-host=220.149.108.146; posting-account=v_GC8QoAAABz34PprEBWdejdnnHZvg4_ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKRUAELSC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4637 On 5=EC=9B=9425=EC=9D=BC, =EC=98=A4=ED=9B=8410=EC=8B=9C15=EB=B6=84, Lew wrote: > On 05/24/2011 09:15 PM, byhesed wrote: > > > > > > > > > > > Can I handle array values using JavaBeans? > > I could'n find the way to pass an array to JavaBeans. > > > Below is my situation. > > > There are four checkboxes. > > I want to handle those values in JavaBeans. > > > -----------------------------------------------------------------------= ---- ------------------------- > > 1. TestBeanForm.jsp > > -----------------------------------------------------------------------= ---- ------------------------- > >
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Java= for Student
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Comp= iler Construction
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Soft= ware Engineering
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Core= Servlet and JSP
> > =C2=A0 =C2=A0 =C2=A0

> > =C2=A0 =C2=A0 =C2=A0 > >

> > -----------------------------------------------------------------------= ---- ------------------------- > > > Here, I use JavaBeans. > > -----------------------------------------------------------------------= ---- ------------------------- > > 2. TestBean.jsp > > -----------------------------------------------------------------------= ---- ------------------------- > > <%@page import=3D"test.TestBean"%> > > > > > =C2=A0 =C2=A0 > > > > > > -----------------------------------------------------------------------= ---- ------------------------- > > > When dealing with thoes values using JavaBeans, > > Only the first books element is passed to JavaBeans. > > Here is my javaBean [sic]. > > > -----------------------------------------------------------------------= ---- ------------------------- > > 3. TestBean.java > > -----------------------------------------------------------------------= ---- ------------------------- > > package test; > > > public class TestBean { > > =C2=A0 =C2=A0private String books; > > > =C2=A0 =C2=A0public void setBooks(String books) { this.books =3D books;= } > > =C2=A0 =C2=A0public String getBooks() { return books; } > > } > > -----------------------------------------------------------------------= ---- ------------------------- > > Where's the array in your bean? > > -- > Lew > Honi soit qui mal y pense.http://upload.wikimedia.org/wikipedia/commons/c= /cf/Friz.jpg I got rid of the code about array. Original code is here. --------------------------------------------------------------------------- ------------------------- 3. TestBean.java --------------------------------------------------------------------------- ------------------------- package test; public class TestBean { =C2=A0=C2=A0 private String[] books; =C2=A0public void setBooks(String[] books) { this.books =3D books; } =C2=A0 =C2=A0public String[] getBooks() { return books; } } --------------------------------------------------------------------------- ------------------------- However, when I pass multiple check box values, A browser only can receive just first one value in checkboxes. Do you know how to handle array values in JavaBean?