struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Preetham Mallavarapu <preethamreddy.mallaar...@gmail.com>
Subject Re: STruts 2 - populating an ArrayList from the JSP
Date Tue, 19 May 2015 08:01:59 GMT
Thanks Christoph Nenning. I found the issue..

Thanks once again.


On Mon, May 18, 2015 at 5:50 PM, Christoph Nenning <
Christoph.Nenning@lex-com.net> wrote:

> Try to use browser dev tools to debug your post request. Make sure the
> parameter names are correct.
>
>
>
>
> >
> > Can you guys help me on this issue?
> >
> > Thanks
> >
> > On Sat, May 16, 2015 at 12:47 PM, Preetham Mallavarapu <
> > preethamreddy.mallaarapu@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I have a problem while accessing the arraylist from jsp in my action
> > > class...
> > >
> > > when I tried to submit the data it isnot returning any values...
> > >
> > > Below is my code..
> > >
> > >
> > >
> > > class Student
> > > {
> > > private int id;
> > > private String studentName;
> > >
> > > //getters and setters
> > > }
> > >
> > > class certificates
> > > {
> > > private int id;
> > > private String certName;
> > > File certificateImage;
> > >
> > > //getters and setters
> > > }
> > >
> > > class StudentManager extends ActionSupport
> > > {
> > > private List<Certificates> studentCertificates= new
> > > ArrayList<Certificates>();
> > >  getCertficates(int studentID)
> > > {
> > > studentCertifictaes = getCertificatesFromDB(studentID); //fetches the
> > > student certifcates from DB
> > >
> > > return "displayCertificatesPage";
> > > }
> > >
> > >
> > > updateCertificates()
> > > {
> > > system.out.println("No of Certificates.."+studentCertificates.size());
> > > updateCertificatesinDB(studentCertificates);
> > >  return "success";
> > > }
> > >
> > >
> > > }
> > >
> > >
> > > certifcates.Jsp Page
> > >
> > >
> > >
> > > <s:form action="updateCertificatesStudentManager"
> > > enctype="multipart/form-data">
> > >
> > > <s:iterator value="studentCertificates" status="stat">
> > >  <s:textfield name="studentCertificates[%{#stat.index}].certName" />
> > > //certificate name can be changed
> > >  <s:file key="Upload File"
> > > name="studentcertificates[%{#stat.index}].certificateImage" ></s:file>
> > > //can be null also//
> > >  </s:iterator>
> > >
> > > </s:form>
> > >
> > >
> > >
> > > flow goes in this way..
> > >
> > > when user requests for certificates page  -> (getCertificates
> > > inStudentManager will be called) -> (displays arraylist data in
> > > certificates.jsp page ) -> (edited information should be submitted to
> > > updateCertificates method in action class)
> > >
> > >
> > > but when the updateCerticates method is called the size of the
> arraylist
> > > shows zero.
> > >
> > > I couldn't trace out the reason why the populated data in arraylist is
> not
> > > getting submitted back to action class...
> > >
> > > Thanks
> > >
> > >
>
> This Email was scanned by Sophos Anti Virus
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message