How to read HTML file and display it for user’s confirmation?

Posted on 2006-05-06
Last Modified: 2010-03-31
How to read HTML file and display it for user’s confirmation?
This is part of the file upload process using Struts.

1.      I developed the upload file page, where I can choose HTML file.
2.      In Action class I need to read that file and display it to the user for confirmation.
3.      After “confirm” save it  to the DB2 table
4.      Display that HTML file, as part of the  “Welcome page”.
The Welcome page should get the last row from the DB2 table and display it.

I am new in Web development trying to switch from  the mainframe.
Really need your help.
I am using Struts, JSP and Java.

Question by:tpolnyi
    LVL 92

    Expert Comment

    if you make it accessible on the web server you can provide a link for the user to view it.
    perhaps in anm iframe allowing you to also include your own content such as a confirmirmation form on the page
    LVL 3

    Accepted Solution

    The follolwing site has a tutorial on how to upload a file using struts.. all it requires is that u use a FormBean with a "FormFile" property..

    1. in the ServeltUploadAction, set the FormFile as a session attribute using :
    request.getSession().setAttribute("uploadedFile", <FormFile object u obtained from the Form bean>).

    2. then you forward to another JSP page ( in the last line of the ActionClasss, "mapping.findForward()", you can tell struts where for forward the request to ).

    3. in the JSP page, like objects mentioned, you create an IFRAME, you then set the "src" attribute of the IFRAME to another Struts ActionClass that streams the above metioned FormFile into the response object. using :


    hope it works..


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Hire Top Freelancers to Complete Java Projects

    Source the talented Expert Exchange community
    for top quality work on your Java projects.

    Hire the best. Collaborate easily. Get quality work.

    Suggested Solutions

    If you have upgraded to Java2 update 10 on a Microsoft Windows client, you may have discovered that your Java application does not work as it did before.  For example, the colors of your Java2D graphic may be all wrong for no apparent reason. Aft…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now