Announcement Announcement Module
No announcement yet.
File upload Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • File upload

    I have to use spring roo to create a web component where the user selects a file(.xls, .xlsx or csv), previews the file contents and the sends the data to a database.
    being in spring roo, I struggled for some days and managed to add a file upload button(in the create.jspx file) using the code below:
    <form action="/uploads" enctype="multipart/form-data" method="post">
    Select File: <input name="file" type="file"/>
    <input type="submit" value="Preview"/>
    I don't know what to do from there. I would appreciate any help or suggestion.

  • #2

    Just follow my tutorial @

    B. Roogards


    • #3
      thanks delgad9 for the invaluable article. Though, what i really need to upload is not the file but the contents of the file. the file could be .xls, .xlsx or csv.


      • #4
        Ok this is what you have to do...

        1) Upload the file as I told you before.
        2) On the server side extract the content based on file format.
        3) Send back a preview page to the User for acceptance/rejection.

        That's it!

        B. Roogards
        Last edited by delgad9; Apr 13th, 2012, 05:32 PM.


        • #5
          Thank you for your direction. I do that and inform you.


          • #6
            File upload

            Sorry but in your code what does the method encodeUrlPathSegment(Java.lang.String, HttpRequest) do?


            • #7
              These type of questions are better answered in or the reference manual.

              I am mostly working on SR solutions not covered there.

              B. Roogards
              Last edited by delgad9; Apr 14th, 2012, 12:52 PM.


              • #8
                File preview

                I have a class called ExcelReader that reads an excel file and puts each row in an Vector called row. Each row is placed in a common static Vector called rows.
                I want to edit the list.jspx file such that when the user clicks on SAVE(which I also want to edit to PREVIEW), it shows them the data in a table format.
                I have tried using jstl to iterate over the Vector as shown below:-

                <c:import url="org.pragmatikroo.roodocman.domain.ExcelReader " ></c:import>
                <c:set var="my-data" value="${ExcelReader.rows}" />
                <c:forEach items="${my-data.rows}" var="row" >
                <c:forEach items="${row.rows}" var="col" >
                <c:out value="${col}" />
                I am getting th following error:- javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in &lt;forEach&gt;
                What is wrong with the code or how should i do it.