Announcement Announcement Module
Collapse
No announcement yet.
File upload Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:
    <div>
    <form action="/uploads" enctype="multipart/form-data" method="post">
    Select File: <input name="file" type="file"/>
    <br/>
    <br/>
    <input type="submit" value="Preview"/>
    </form>
    </div>
    I don't know what to do from there. I would appreciate any help or suggestion.

  • #2
    @joash

    Just follow my tutorial @ http://viralpatel.net/blogs/2011/02/...-tutorial.html

    B. Roogards
    jD

    Comment


    • #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.

      Comment


      • #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
        jD
        Last edited by delgad9; Apr 13th, 2012, 04:32 PM.

        Comment


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

          Comment


          • #6
            File upload

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

            Comment


            • #7
              These type of questions are better answered in http://www.manning.com/rimple/ or the reference manual.

              I am mostly working on SR solutions not covered there.

              B. Roogards
              JD
              Last edited by delgad9; Apr 14th, 2012, 11:52 AM.

              Comment


              • #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:-

                <div>
                <table>
                <code>
                <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" >
                <tr>
                <c:forEach items="${row.rows}" var="col" >
                <td>
                <c:out value="${col}" />
                </td>
                </c:forEach>
                </tr>
                </c:forEach>
                </code>
                </table>
                </div>
                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.

                Comment

                Working...
                X