Results 1 to 4 of 4
  1. #1
    HardRock is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    0

    Question How to read the contents of uploaded file?

    How the read the contents of file uploaded in and how to use function and methods in JSP page?

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    758
    Rep Power
    8

    Default Re: How to read the contents of uploaded file?

    There is a scripting elements called as declarations in JSP page that you can use to declare variables or methods. The declaration enclosed with a <%! .... %>. As an example you:

    Java Code:
    <html>
    ...
    ...
    <%!
    public String say() {
        return "Hello there!";
    }
    %>
    ...
    ...
    Hi, <%= say() %>
    ...
    </html>
    Note: using a scriptlets is considered as not a good practice when creating a JSP page. You'll need to separate between presentation and the logic of you page by combining a JSP page with a servlet.

  3. #3
    HardRock is offline Member
    Join Date
    Jun 2012
    Posts
    5
    Rep Power
    0

    Default Re: How to read the contents of uploaded file?

    Actually I have already made my classes and projects separately and i want use those methods in a JSP page, how can i use that???

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: How to read the contents of uploaded file?

    You'll want to use them in a servlet which will then pass the information needed by the JSP to display.
    The JSP shouldn't be doing the calling, it should (largely) just be getting view beans out of the request and using them to lay out the page.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. how to read a file and change its contents.
    By mointariq in forum New To Java
    Replies: 1
    Last Post: 04-30-2012, 07:19 PM
  2. Getting Inputstream of a uploaded file
    By nn12 in forum New To Java
    Replies: 0
    Last Post: 03-26-2011, 06:54 AM
  3. Read and Write depending on file contents
    By paulhenderson in forum Java Applets
    Replies: 3
    Last Post: 02-15-2010, 12:38 PM
  4. how to specify location of file to be uploaded?
    By anthrax in forum New To Java
    Replies: 11
    Last Post: 01-13-2010, 02:48 PM
  5. Replies: 2
    Last Post: 05-11-2009, 10:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •