Problem with showing doc file in textarea of Jsp page

try{
int i;
out.println("<TEXTAREA cols=90 rows=30 readonly>");//initiate text area
String filename="C:\\AdminJudis\\judgement.doc";
FileInputStream f=new FileInputStream(filename);
//here you write the contents of the file
while((i = f.read()) != -1){
out.write((char)i);
}catch(Exception e){
System.out.println(e);
out.println("</TEXTAREA>");
I am using this code but it show some garbadge values in it

KalyanSundar
you have to give absolute path to file object ( physical full path)
you can get this by
getServletContext().getRealPath("testing/photos");
so you will get something like
d:\tomcat\webapps\testing\photos
and pass this address to the file object
i.e. File photos = new File(getServletContext().getRealPath("testing/photos"));

Similar Messages

  • Hi! I´m having problems with showing video files in Qlab on my Macbook Air. A sound/video technician told me to "blow out" my Mac. Was told to use  cmd+ r  when restarting. Is this the right way?

    Hi! I´m having problems with showing video files in Qlab on my Macbook Air. It started suddenly. Consulted a sound/video technician who told me to "blow out" my Mac. Was told to use cmd+r  when restarting. Is this the right way to clean up my Mac? And is it likely that some kind of bug is causing problems for Qlab to show video files? I´ve already tried with a bunch of different video files and sometimes Qlab plays them and sometimes not. I need the Qlab playlist for a theatre show and only have a week until showtime so starting to really worry. Is there anyone out there who can help?

    Your Mac runs maintenance in the background for you.
    Command + R gives you access to restore, repair, or reformat the drive using OS X Recovery
    No idea why that was suggested.
    You may have a third party video player installed that's causing an incompatibility issue.
    Check these folders:
    /Library/Internet Plug-Ins/
    /Library/Input Methods/
    /Library/InputManagers/
    /Library/ScriptingAdditions
    ~/Library/Internet Plug-Ins/
    ~/Library/Input Methods/
    ~/Library/InputManagers/
    ~/Library/ScriptingAdditions
    The first four locations listed are in the root-level Library on your hard disk, not the user-level Library in your Home folder.The tilde (~) represents your Home folder.
    To access the Home folder in OS X Lion or Mountain Lion, open the Finder, hold the Option key, and chooseGo > Library.

  • Problem with opening doc. files in pages '09

    Hello, can anybody help me, ever since i installed " snow leopard" v10.6.2, pages '09 doesn't open doc. files ( word ) anymore.
    Even documents produced in pages en ""saved as" a word document can't be opened again.
    Keep receiving pop up whit message " can not be opened"
    Yves
    Message was edited by: deschutter

    You need to manually install the 10.6.2 "Combo" version, there were problems with just using the regular update.
    See:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=153&mforum=iworktips ntrick
    Peter

  • Problem with showing a group of records in dynamic page (PLS-00428  error)

    Hi
    I have problems with viewing a group of records from db. I've created Page, which "Page Type" attribute is "PL/SQL". In "PL/SQL Code" field, I've written very simple SQL query: "SELECT * FROM PORTAL_DEMO.EMP ;"
    I'd like to generate HTML table with it's result. Unfortunately, every time I get the same Exception:
    Error 30584: DBMS_SQL has raised an unhandled exception. ORA-06550: line 1, column 7: PLS-00428: an INTO clause is expected in this SELECT statement
    Is it necessary to write a COURSOR (and use HTP function) to realize this functionality? I succeed, trying this way - but it is very uncomfortable ( a lot of code ).
    What I have done in wrong way?
    Please help me.
    Best regards
    Mario

    How do I handle this?

  • JEditorPane problem with showing html file

    Hey,
    I have a JEditorPane in which I would like to show a HTML file that is stored in the same directory (local, not from the web).
           String url = "index.html";
            try
                JEditorPane htmlPane = new JEditorPane(url);
                htmlPane.setEditable(false);
                frame.add(new JScrollPane(htmlPane));
            catch(IOException ioe)
                System.err.println("Error displaying " + url);
            } It should also work once the whole program is "packaged" into a .jar file.
    With the code above I cant get the index.html file to be displayed in the htmlPane.
    Any suggestions?
    thanks.

    The JEditorPane has a method called setPage that loads a URL into the pane, you can always transform internal jar locations to URLs using e.g. CurrentObject.class.getResource("/internal/jar/location/text.html")

  • InDesign CS5 causing problems with InCopy assignment file but not content files

    I'm having a strange InDesign/InCopy CS5 issue (Mac OSX 10.6.6; all system & Adobe updates are current).  In my InDesign doc I have one assignment file containing two content files. All of the InCopy pieces work fine in InDesign (i.e., I can check out/in, edit, etc.).  When I go to open the assignment file in InCopy, InCopy starts to open  it but then crashes. If I try to open each content file directly in  InCopy, no problem. I've tried deleting and recreating new assignments  in InDesign, but they all have the same result in InCopy.
    I think this actually is a problem with the InDesign file because if I export the InDesign file to IDML, then try to open the IDML file, InDesign crashes! I've trashed my InDesign preferences, made sure all cross-references are up to date, etc. Anybody have any ideas what else to look for in my InDesign file that might cause this problem?
    Thanks!
    Andrea

    Thanks John!
    1) Here are the first 10-ish lines from the crash report that is generated when I try to open the IDML file:
    Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
    0   ???                               0xa0c266f0 _XHNDL_trapback_instruction + 0
    1   com.adobe.InDesign.Indexing       0x20778192 GetPlugIn + 341394
    2   com.adobe.InDesign.Indexing       0x20779009 GetPlugIn + 345097
    3   PublicLib.dylib                   0x0129228b CScriptProvider::AccessProperties(IScriptRequestData*, IScript*) + 571
    4   com.adobe.InDesign.Scripting      0x1f4befe8 GetPlugIn + 166440
    5   com.adobe.InDesign.Scripting      0x1f4c2e31 GetPlugIn + 182385
    6   com.adobe.InDesign.INXCore        0x20641444 GetPlugIn + 45220
    7   PublicLib.dylib                   0x0142c9e8 CScriptDOMElement::GetMultipleAttributes(K2Vector<IDType<ScriptID_tag>, K2Allocator<IDType<ScriptID_tag> > > const&, adobe::version_1::vector<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue>, adobe::version_1::capture_allocator<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue> > >&) + 280
    8   PublicLib.dylib                   0x0142bd38 CScriptDOMElement::InsertProperties(adobe::version_1::vector<KeyValuePair<IDType<ScriptID _tag>, ScriptData>, adobe::version_1::capture_allocator<KeyValuePair<IDType<ScriptID_tag>, ScriptData> > >&, adobe::version_1::vector<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue>, adobe::version_1::capture_allocator<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue> > > const&, short, short) + 1336
    9   PublicLib.dylib                   0x0142beab CScriptDOMElement::SetSimpleAttributes(adobe::version_1::vector<KeyValuePair<IDType<Scrip tID_tag>, DOMAttributeValue>, adobe::version_1::capture_allocator<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue> > > const&, short) + 91
    10  PublicLib.dylib                   0x0142c0d3 CScriptDOMElement::SetAttributes(adobe::version_1::vector<KeyValuePair<IDType<ScriptID_ta g>, DOMAttributeValue>, adobe::version_1::capture_allocator<KeyValuePair<IDType<ScriptID_tag>, DOMAttributeValue> > > const&) + 51
    11  PublicLib.dylib                   0x0142a2ea CScriptDOMElement::SetAttribute(IDType<ScriptID_tag>, DOMAttributeValue const&) + 202
    2) That works. Moved all pages (frame threading was preserved) to a new doc, exported to IDML, opened new IDML file just fine. Woo hoo! One of my editors won't be pleased that all of the tracked changes have disappeared, but at least the file functions now
    Wish I knew what caused the problem in the first place so we could (hopefully) prevent this from happening again. Any ideas?
    Thanks again for your help!
    Cheers,
    Andrea

  • Problem with printing txt file

    I have a problem with printing txt file. My code looks like :
    String filename = something.txt";
    DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
    PrintService[] services = PrintServiceLookup.lookupPrintServices(
              flavor, null);
    PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
    pras.add(PrintQuality.DRAFT);
    pras.add(new Copies(1));
    pras.add(MediaSizeName.ISO_A4);
    pras.add(Sides.ONE_SIDED);
    pras.add(Chromaticity.MONOCHROME);
    PrintService service = ServiceUI.printDialog(null, 200, 200,
              services, services[0],
              null,
              pras);
    if (service != null)
    try
    DocPrintJob job = service.createPrintJob();
    FileInputStream fis = new FileInputStream(filename);
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(fis, flavor, das);
    job.print(doc, pras);
    Thread.sleep(10000);
    catch(FileNotFoundException e)
    catch(PrintException e1)
    catch(InterruptedException e2)
    It doesn't work :(
    What is my purpose: I would like to print .txt file but I would like to get PrintDialog where I can choose PrintQuality, Chromaticity etc. I found also that I should use DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST but I don't know how.
    I will be very gratefull for help :)

    I tested it on 3 printers (different models of hp). 2 of them don't give me any error but when it started print priter stoped (just as it dosesn't have a paper), but 1 of them doesn't react (there were no errors), i thought tahat something was wrong with printers but when I change DocFlavor.INPUT_STREAM.AUTOSENSE to DocFlavor.GIF and filename to dog.gif it works so mybe there is another way to print txt file

  • Problems with reading XML files with ISO-8859-1 encoding

    Hi!
    I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
    Here's the code:
    import java.io.File;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.net.*;
    * @author gustav
    public class RSSDocument {
        /** Creates a new instance of RSSDocument */
        public RSSDocument(String inurl) {
            String url = new String(inurl);
            try{
                DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = builder.parse(url);
                NodeList nodes = doc.getElementsByTagName("item");
                for (int i = 0; i < nodes.getLength(); i++) {
                    Element element = (Element) nodes.item(i);
                    NodeList title = element.getElementsByTagName("title");
                    Element line = (Element) title.item(0);
                    System.out.println("Title: " + getCharacterDataFromElement(line));
                    NodeList des = element.getElementsByTagName("description");
                    line = (Element) des.item(0);
                    System.out.println("Des: " + getCharacterDataFromElement(line));
            } catch (Exception e) {
                e.printStackTrace();
        public String getCharacterDataFromElement(Element e) {
            Node child = e.getFirstChild();
            if (child instanceof CharacterData) {
                CharacterData cd = (CharacterData) child;
                return cd.getData();
            return "?";
    }And here's the error message:
    org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
        at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
        at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
        at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
        at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
        at getrss.RSSDocument.<init>(RSSDocument.java:25)
        at getrss.Main.main(Main.java:25)

    I read files from the web, but there is a XML tag
    with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
    Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
    In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s).

  • Problem with showing mp3 album art in list view.

    Hello.
    I have litle problem with showing mp3 album artwork in list view.
    In SNOW LEOPARD all work fine, and all mp3 files have album art's preview in list mode in finder.
    But in LION i have only default preview mp3 icon.
    Option "Show icon preview" is already on!

    I have the fix!!!!
    I have had the same issue ever since Lion. Its been very painful not having album art preview in finder or the play button when rollover the file for so many versions of OSX. Today I worked hard in trying to solve the problem since Applecare support hasn't helped much, all they did was tell me to bring the computer in. The other main reason I got so motivated to try and fix this is because the DJ app for Mac only reads album art from the finder even if iTunes can display the album art. The other reason that got me curious is that my friends macbook pro album art worked fine, so I cross checked with his computer until I figured out a few things that helped and ultimately fixed the issue. FINALLY!
    My set up:
    - I have my full iTunes library folder on my external as I have over 700GB of music.
    - It includes all my database files in there, which is very important as I have many playlist settings from over 7 years of iTunes activity.
    SOLUTION:
    1. With every new computer I have purchased, I use to just pressed option on Mac and press iTunes to locate my folder (which I have said is located on my external drive).
    2. I tried today to press option again BUT locate and selected the default library in the user/music folder of my internal drive (standard setting from Apple).
    3. Miraculously, all the album art appeared in both my external drive library and also today's downloaded songs on my Macbook pro. Ofcourse with the new default location I don't have any songs or data.
    4. So I tried to find a way to keep this library data on my internal drive since it can help the finder display all my files properly, yes even have the play on rollover button but as well link it back to my external drive with all my 700GB songs.
    5. I then went into iTunes Preferences/Advance tab and in iTunes Media folder locationredirected the location to my external drive iTunes/ iTunes Media folder. If it asks to collate data, press NO.
    6. Then I quit iTunes.
    7. Next I copied the 4 files to my desktop from my external drive as I want to keep the data I have made with all my playlists etc. The four files are iTunes Library Extras.itdb ,iTunes Library Genius.itdb , iTunes Library.itl , iTunes Library.xml
    8. I then went to my internal drive User/Music/Itunes/ and dragged these 4 files I copied from my external drive into here and making sure to REPLACE the four existing files already there.
    9. Next open iTunes and you will find all your presettings appear with all your music linked to your external. What this does is keep the important library files on your internal drive (that somehow makes your finder files album art appear), BUT to read also all the music mp3 files located in the external drive (action from step 5)
    Presto!! All your music files whether on internal drive or external all the album art has appeared.
    Hope this helps!! Let me know if there are any other questions.
    I am on 10.8.1 running retina macbook pro.

  • Got problems with creating RTF-files after OSX update

    Hi
    I don't know if this is really a MAC OS problem, but it occurred after I updated to 10.5.2 - so it's a likely suspect.
    Since the update I can't create RTF-files any more with Final Draft, my script writing program. A file is created, but when I try to open it I get an error message that it cannot be found. But the file is there: I can see it and click on it. It just won't open.
    Only today now I got the same error message with a doc-file I downloaded some months ago.
    The only big change I lately made to my Mac was the update to 10.5.2 and I got the new Office 2008 (both are the German versions). Could the problem come from either of them? I contacted Final Draft's support - they didn't know of the problem.
    Maybe someone else in this forum has encountered similar problems?

    Have you tried to Repair Permissions using Disk Utility?
    1. Open Disk Utility in your Applications/Utility folder.
    2. Click on the icon for your boot volume.
    3. Click on the First Aid tab and select Repair Permissions
    4. Click the repair permissions button.
    This is the first thing to try whenever any program goes wonky. It's free, but takes awhile for all the files that have to be checked and changed.

  • Problems with some PDF files

    Hi,
    I have problems with some PDF files. After clicking on link to the file Safari shows me insted of normal document (which is working on Windows) hashes, numbers etc like it was a problem with coding or something. First I was using Preview, I though that maybe installing Acrobat Reader with plugins will solve the problem, but ofcourse it didn't. Did somebody has this same problem?

    Back up all data.
    Please triple-click anywhere in the line below on this page to select it:
    defaults delete -app Safari WebKitOmitPDFSupport
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Quit Safari. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing the key combination command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    Wait for a new line ending in a dollar sign (“$”) to appear below what you entered. You can then quit Terminal. Test.

  • Tempo problems with imported wav files

    Hey everyone, sorry if there's a quick fix for this in the forums that I couldn't find, but I've been having some tempo problems with imported .wav files.
    Long story short, my system couldn't handle playing all the tracks for a song while recording drums, so I bounced out an mp3 of the song and put it in a new Logic file so my drummer could just play along to that as I recorded him. Unfortunately, the original song is at 167 bpm, but I forgot to change the bpm in the new Logic file with the .mp3 file of the song to 167 bpm, so it was left at the default 120 bpm.
    So, the drums were recorded at the correct 167 bpm, but Logic thinks that those new drum .wav files should be played at 120 bpm, so when I import my drum tracks back into the original file, they do not play correctly at all.
    I could get record it all again, but I wanted to check if there was a way I could salvage what I already have, since my drummer lives about an hour away right now and can't just come over whenever he wants.
    Thanks for the help! I really appreciate it.

    Hi,
    First, do not use MP3 in Logic, the sound quality is less than AIFF, WAV or CAF, and Logic has to decode it for playback, making it a heavier burden on the CPU than an uncoded audiofile, such as AIFF, WAV or CAF.
    Secondly, audio files are independent of Logic's tempo. If you bounce down an audio file in any format (other than Apple Loop), it will play back at the same speed, +regardless of Logics' tempo setting+, either at recording or playback. Logic doesn't 'think' anything. The BPM is only important to MIDI tracks, or to the spacing between audio files. The audio files themselves *are not affected* by the tempo setting. If you import an audio file of tempo 167 into a 120 BPM project, the file will still play at 167, only Logic will indicate the wrong bar positions.
    regards, Erik.

  • Problem with preview PDF files on Windows 7 32bit

    Hello,
    in my office I have a problem with preview PDF files on my computers. The files are allright, but if I select a file and click on preview mode after ~ 10sec operation system write something "Preview this file is corrupt for PDF Preview Handler wrong". On other 64bit computers with same programs the preview is work. I try uninstall all Adobe soft (Reader, Flash), clean all Adobe data from folders in root and in register, but it is not solve this problem. On Microsoft forums wrote me, that the problem is probably with AR plugin.
    So, can someone help me?
    Config PC:
    Windows 7 32/64bit Pro
    Intel i3, 4GB
    Adobe Reader 11.0.5
    Adobe Flash Player 15 ActiveX
    Adobe Flash Player 15 plugin
    Preview Handler Surrogate Host ver.: 6.1.7601.17514
    Thank you for help.

    I think I figured it out after reading other forums. Thanks!

  • Problem with printing pdf file

    hello,
    lately i have problem with printing pdf file:
    i click on the print button and the respod is very slow
    it takes more than a minute till the print window apears.
    i tryied to install version X but it's the same, the problem exist only when printing via adobe reader,
    other programs i'd working much faster.
    please advice,
    thank you

    No, it is not set to overprint. Also, I have to add that the printing results were not consistent. Sometimes it covered and sometimes it did not.

  • Problem with uploading a file in Clustered Environment

    Hi,
    I have a problem with uploading a file in a clustered environment. I have an iview component which facilitates an upload action of an xml config file. The problem is that the upload of the modified XML file is reflected only in the central instance of the cluster and not in the dialog instances. The dialog instances hold the old config file.
    Is there any solution to upload the file to all the nodes in the cluster.
    Thanks
    Kiran

    Hi,
    This is a known problem with clustered environment. Remember that your portal component runs on just on dialog instance and it doesn't automatically have access to the other nodes.  However, there are some ways to get around this
    1. Use KM to store files. KM is a common repository for all application servers and therefore you needn't worry more
    2. Use an external batch oriented product (suresync/robocopy) to synch folders on the different DIs. You basically use your existing portal component, but there is a batch job which makes sure the upload folder is identical on all DIs (however, there is a slight delay depending on how often you run the batch job)
    3. Store the files on a shared disk directly from the portal component.
    Cheers
    Dagfinn

Maybe you are looking for

  • Error message when deploying war file to sun web server 6.1

    i've been trying to deploy an application developed locally in tomcat to a local install of sun web server 6.1, and can't seem to get it to work. the error message i am getting now is: [05/Dec/2008:12:44:08] config ( 1640): for host xxx.xxx.xxx.xx tr

  • SAP eSourcing with SRM Extended Classic Scenario

    Hi Team, We are using ECC 6.0 with eSourcing. Currently we use SRM 5.0 with Classic Scenario. Now we are planning an upgrade from SRM 5.5 to SRM 7.0 and want to do the Extended Classic Scenario. This will help us to do additional functionalities of S

  • Business component

    Hi Everyone, I am new to SAP PI and was practicng some scenarios. I got a doubt while using Business component. For business system, we ll configure details in SLD whereas business component  is an abstract unit.Then,how the created business componen

  • Windows XP on a Mac

    So... I know you can Put windows on a mac... I've just bought a mac mini, and i'm gonna put boot camp on it... so now my question is, Does it have to be Windows XP PRO or can it be windows XP Media Edition-

  • Random album playlist on iphone

    Hello, so I'm actually embarassed because I'm not able to make any random album playlist on my iphone, maybe due to a new update. Before I made a smart playlist where I choosed to sort my albums randomly, so i can enjoy my albums entirely, then I syn