Web Design and Development Forums

Really need help here..urgent!!

This is a discussion on "Really need help here..urgent!!" within the Java, JSP, Cold Fusion section. This forum, and the thread "Really need help here..urgent!! are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > Java, JSP, Cold Fusion

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Jun 27th, 2007, 05:15   #1 (permalink)
New Member
 
Join Date: Jun 2007
Location: Makaysia
Age: 21
Posts: 2
Post Really need help here..urgent!!

Hello... i have a process where user want some data file(textfile.txt) from somewhere for example from D:\smart\445566.txt. After user have that file, user can choose whether he want save that file or display it as a text file. I have searched many times through web but didn't find any suitable example or solution..
So..anyone here can give me some idea or code example about this problem???
~i'm using JSP..
~i really really need help here..
~thanks...
mawarzinnirah is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Jun 27th, 2007, 06:37   #2 (permalink)
 
c010depunkk's Avatar
 
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 612
Blog Entries: 2
Send a message via MSN to c010depunkk
Re: Really need help here..urgent!!

I have no clue about JSP but in PHP that's no problem: Download: zip the file dynamically and give the user the link. View: either just give the user a link to the file or, a much better solution, read the file with PHP and output it with some css formatting. I don't know if you have the possibility to use PHP, I hope this helps.
__________________
Web design is the creation of digital environments that facilitate and encourage human activity; reflect or adapt to individual voices and content; and change gracefully over time while always retaining their identity.

~ www.c010depunkk.com ~ the hang-out of a web developer

c010depunkk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Jun 27th, 2007, 07:13   #3 (permalink)
New Member
 
Join Date: Jun 2007
Location: Makaysia
Age: 21
Posts: 2
Re: Really need help here..urgent!!

thanks for the reply..
But i have to do it in JSP...
Hope anyone in here can give me some idea or example
~thanks...
mawarzinnirah is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Sep 17th, 2007, 14:00   #4 (permalink)
New Member
 
Join Date: Sep 2007
Location: Bristol
Posts: 3
Send a message via Skype™ to stevev
Re: Really need help here..urgent!!

The easy option would be just to supply a link to the file. Assuming it's just a text file, when the user clicks on the link, the browser should render the file contents on screen or pop up the download window.

If you want to display the file contents within your JSP page (a textarea for example) you'll need to do something server side with your JSP/Servlet code.

Somthing like this should do it:

Code: Select all
public static String getStringFromFile(String path)
    throws IOException {
        StringBuffer buff = new StringBuffer(5000);
        BufferedReader in = new BufferedReader(new FileReader(path));
        try {
            String line = null;
            while ((line = in.readLine()) != null) {
                buff.append(line).append('\n');
            }
        } catch (IOException ex) {
            log.error("Problem getting string from file", ex);
            throw ex;
        } finally {
            if (in != null) in.close();
        }
        return buff.toString();
    }
This method returns the contents of a file as a string that you can then display in your JSP page.

Hope this helps.

-Steve

www.shopformat.com
stevev is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
jsp

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some urgent help....!!!! shevorne CSS Forum 9 Sep 30th, 2007 23:36
Urgent help please marie2007 PHP Forum 3 Sep 9th, 2007 22:44
urgent help req.. s_mazhar Graphics Forum 5 Oct 31st, 2005 09:04



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 23:06.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59