Can you guys help me on this issue?

Thanks

On Sat, May 16, 2015 at 12:47 PM, Preetham Mallavarapu <
preethamreddy.mallaar...@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
>
>

Reply via email to