Show file content

hi folks,
one more try
in wd abap i can make an upload of an file, are there any (besides office and pdf) viewers available to view those files in a wd abap application.
kind regards,
oliver

Why don't you use Java Script to reference the xml file and open it in a new window from your JSP?
String browserFilePath = request.getContextPath() + "/some_directory/myfile.xml";
then in your jsp
<% if (...???) { %>
<Script>window.open('<%=browserFilePath%>')</Script>
{% } %>

Similar Messages

  • Show file content in jsp

    i want to get an xml file and give the client user.maybe in the jsp i write the XML content to notepad.But i don't know how can i open notepad and write the content to it.
    pls tell me the the right way! thanks a lot a lot!

    Why don't you use Java Script to reference the xml file and open it in a new window from your JSP?
    String browserFilePath = request.getContextPath() + "/some_directory/myfile.xml";
    then in your jsp
    <% if (...???) { %>
    <Script>window.open('<%=browserFilePath%>')</Script>
    {% } %>

  • FILE UPLOAD PROBLEM SHOWING THE CONTENTS IN THE SAME BROWSER WINDOW

    Hi,
    This is amit Joshi
    I have uploaded content using input tag of type file and posted to jsp as multipart/form-data type
    in that jsp i am using following code to display the content in browser but only first content is displayed How can i modify it to show all content in the file ..
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
    FileItem fileItemTemp = (FileItem)it.next();
    if (fileItemTemp.isFormField()){
    %>
    <b>Name-value Pair Info:</b>
    Field name: <%= fileItemTemp.getFieldName() %>
    Field value: <%= fileItemTemp.getString() %>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
    optionalFileName = fileItemTemp.getString();
    else
    fileItem = fileItemTemp;
    if (fileItem!=null){
    String fileName = fileItem.getName();
    %>
    <b>Uploaded File Info:</b>
    Content type: <%= fileItem.getContentType() %>
    Field name: <%= fileItem.getFieldName() %>
    File name: <%= fileName %>
    <%
    if(fileItem.getContentType().equals("image/jpeg")) { %>
    File : <p><%
         //response.setContentType("image/gif");
         byte[] bArray=fileItem.get();
         response.setContentType("image/jpeg");
         outputStream=null;
         outputStream= response.getOutputStream();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    else if(fileItem.getContentType().equals("text/plain"))
         %> File : <%= fileItem.getString() %>
    <%
    byte[] bArray=fileItem.get();
    response.setContentType("text/plain");
         outputStream = response.getOutputStream();
         out.println();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    %> </p> <%
    %>
    </body>
    </html>
    Edited by: Amit_Joshi on Nov 13, 2007 10:58 PM

    Well Well Well..
    That would not work...
    What you have to do is save the uploaded file content on to a location and then pass the fileName as a request parameter to a deidicated which displays the contents of that file.
    Just as an example
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
       FileItem fileItemTemp = (FileItem)it.next();
    %>
    Name-value Pair Info:
    Field name: <%= fileItemTemp.getFieldName() %><br/>
    Field value: <%= fileItemTemp.getString() %><br/>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
        optionalFileName = fileItemTemp.getString();
    if(!fileTempItem.isFormFiled()){
       String fileName = fileItem.getName();
       fileItem.write(optionalFileName);
    %>
    Uploaded File Info:
    Content type: <%= fileItem.getContentType() %><br/>
    Field name: <%= fileItem.getFieldName() %><br/>
    File name: <%= fileName %><br/>
    <%
    if(fileItem.getContentType().equals("image/jpeg") || fileItem.getContentType().equals("image/pjeg")) {
    %>
      <img src="FileServlet?fileName=<%=optionalFileName%>"   
    <%
    %>
    </body>
    </html>a sample code snippet for FileServlet.
    String fileName =  request.getParameter(fileName);
      File file = new File(fileName);
       if(!file.exists())
         return;
      // If JSP
      String mimeType = application.getMimeType("fileName");
           If you are using servlet
           String mimeType = this.getServletContext().getMimeType(fileName);
         response.setContentType(mimeType);  
         response.setHeader("Content-Disposition","inline;filename=\\"+fileName+"\\");
      BufferedOutputStream out1 = null;
      InputStream in = null;
      if(mimeType == null)
         mimeType = "application/octet-stream";
      try{
         in = new FileInputStream(f);
         response.setContentLength(in.available());
         BufferedOutputStream out1 = new BufferedOutputStream(response.getOutputStream(),1024);
         int size = 0;
         byte[] b = new byte[1024];
         while ((size = in.read(b, 0, 1024)) > 0)
            out1.write(b, 0, size);
      }catch(Exception exp){
      }finally{
          if(out1 != null){
             try{
                out1.flush();               
                out1.close();
             }catch(Exception e){}
          if(in != null){
            try{in.close();}catch(Exception e){}
      } Hope that might answer your question :)
    However,this is not the recommended way of doing this make use of MVC pattern.Would be a better approach.
    you might think of googling on this and can findout what is the best practise followed for problems of this sort
    REGARDS,
    RaHuL

  • WHEN OPENING A FILE WITH FIREFOX MULTIPLE FILES KEEP OPENING IN RAPID SUCCESSION WITHOUT SHOWING ANY CONTENT AND THIS DOES NOT STOP AND I CANNOT SAY HOW MANY FILES I HAVE

    THERE IS A PROBLEM IN OPENING ANY FILE. WHEN OPENING - A RAPID SUCCESSION OF FILES OPEN, ONE ATOP THE NEXT, WITHOUT SHOWING FILE'S CONTENT. THIS CONTINUES FOR QUITE A WHILE. I MUST TURN OFF COMPUTER. IT IS NOT POSSIBLE TO CHOOSE ANY OTHER FUNCTION WHILE THIS IS HAPPENING, IE : WHEN OPENING A FILE. AS IN , I CANNOT OPEN GOOGLE OR MAIL, ETC. AND THE FILES KEEP OPENING AS UNTITLED. SO I AM NOT ABLE TO OPEN ANY ONE FILE, AND SEE ITS CONTENT, THEY JUST KEEP STACKING LIKE EMTY PAGES ONE ON TOP OF THE NEXT.

    THANK YOU
    THAT DOES NOT SEEM TO BE THE ANSWER
    I HAVE A MAC
    BOUGHT IN 2008
    AND I DO NOT SEE THAT I HAVE A STUCK KEY
    PERHAPS I AM NOT UNDERSTANDING WHAT YOU MEAN

  • From browse button of input type=file, can I show the content of a file

    Hi all,
    I am using, input type=file, where browse button appears. I am having a text area. My requirement is after I select the browse button, I need to show the content of the file in the text area. As of now I 've handled by having another button 'show', which should be pressed after browse done. But, How to handle it in the browse button itself, how will I get that action event from browse button. Plz help.
    Regards,
    Sam

    I think someone asked a very similar question here,
    http://forum.java.sun.com/thread.jsp?forum=45&thread=501889
    check the thread, it may help you.
    -S-

  • I have multiple libraries in iPhoto. When I follow the instructions User/Pictures/iPhoto library/Show package contents/Master /Duplicate I have no problem. When I go thru the same sequence but with iPhoto Galapagos I cannot duplicate its master file. What

    I have multiple libraries in iPhoto. When I follow the instructions:  User/Pictures/iPhoto library/Show package contents/Master /Duplicate I have no problem importing these image. When I choose the file titled...Pictures/iPhoto Galapagos I am unable to show package contents/Master and duplicate the images in this file. What am I doing wrong?
    Thanks

    have multiple libraries in iPhoto. When I follow the instructions:  User/Pictures/iPhoto library/Show package contents/Master /Duplicate I have no problem importing these image. When I choose the file titled...Pictures/iPhoto Galapagos I am unable to show package contents/Master and duplicate the images in this file. What am I doing wrong?
    Thanks

  • How to show the file contents in a streaming manner on the browser

    Hi,
    I have a log file which gets appended to by another program.
    I need to show the contents of this log file in the browser window but in a streaming manner. Reading the file in one shot and refreshing the page every few seconds is not a solution as it makes the browser hang when the file size is huge. A unix tail functionality is also acceptable but it should be streaming. Would a servlet or applet do the trick?
    Please advise!

    is your log file present on web/application server? if yes, you can do the following:
    1. create a web page containing text area. (for displaying log file)
    2. use XmlHttpRequstObject (Ajax) for querying the next available data from Servlet.
    On the Serverside:
    You can store the the FileScanner object in session scope. and use it to read the next available data and send it as response.
    On the client Side(webpage/javascript)
    read the contents of the response and append it to textarea.
    In Simple words, I'd say AJAX is the way to go.

  • Concatenated PDF file does not show all content.

    When I concatenate 2 single page pdf file into one pdf file, the concatenated page does not show all the content. It misses the last line on the 2nd page.
    However the thumbnails view shows the missing line correctly.
    Also, if I view the concatenated pdf into another pdf view, it shows the content correctly.

    Upon further research in the merged pdf file, it appears the merged pdf file has 2 references to the same field "UFE_ISSUE_DATE".
    If I edit the pdf file in the text editor and change one of the field name to "UFE_ISSUE_DATE_TEST", then the pdf gets rendered correctly with date value shown correctly!
    So, we decided to use 2 different field names in each of the individual pdf for this field only.
    But, what causes confusion is that we do have several other fields with same field name in each of the individual pdf file, but upon merge they appear correctly. Searching for such field name in the merged pdf file via text editor, I can see only 1 reference. Not sure, why this particular field "UFE_ISSUE_DATE" has 2 references in the merged pdf file.
    Any one has any thoughts?

  • How do i "show package contents" on .webtemplate files that have arrow

    Hi,
    Quick question:
    How do i "show package contents" on .webtemplate files that have a small arrow attached on the file icon. Its a template a downloaded from 11mystics.com (free). When i right click the icon there is no "show package contents" available on the drop down menu....
    Thanx!

    When you bring up the contextual menu for the icon, choose "Show Original". This will take you to where the original file is and you should be able to "Show Package Contents" on it.

  • My I-Pad screen is black, I tried to sync and restore I-Pad, it showes the contents on the computer and pulling out pictures and other files, but screen is black. what can I do?

    My I-Pad screen is black!! I tried to sync and restore I-Pad, it showes the contents on the computer and pulling out pictures and other files, but screen is black. I don't know what happened! what can I do?

    I have this problem as well...however, resetting/restoring did not take place when I followed the same instructions but got nothing on the screen.  Thanks in advance.

  • File Explorer in Windows 8.1 does not find and show pdf content in Search?

    Have a new computer using Windows 8.1 and I have to search foe file content. I am not able to find my .pdf file content when I use File Explorer

    Sounds like a question for Microsoft...

  • I am trying to Show Package contents of iMovie and it freezes at the hr.lprog folder

    While doing a virus scan my machine would freeze on the file
    Applications/iMovie/Contents/Resource/hr.lprog/Title-SidewaysDrifting.nib/keyedo bjects.nib.
    Bitdefender said to send them the file.
    I am able to "Show package contents" of iMovie, and open the Contents and Resources folder. When I try to open the hr.lprog folder, I get the spinning beach vball of death and I have to reboot my machine using the power button.
    Does anyone have an idea what might be causing this and how to fix it?
    Is the hr.lprog folder just the language files for Croatia? If so, can I safely delete them, or is there more to it?

    My guess would be that your hard drive has become corrupt, and the corruption is affecting something about that folder or its contents such that when the Finder tries to display them, it crashes. I would recommend immediatelyrepairing with Disk Utility. Also, if you don't have any backups, now would be a good time to start, before something bad happens.
    If repairing the hard drive doesn't work, I would try deleting and reinstalling iMovie.
    Also, note that I don't recommend BitDefender. Read my Mac Malware Guide, and if after reading that you want to have anti-virus software, use one of the programs it recommends. BitDefender has performed poorly in my anti-virus software testing, both in the first round and the second round of testing.

  • 'Show JInternalFrame Contents While Dragging'

    hi,
    I have a question I have an application that has internal frames, Basically it is a MDI Application. I am using JDK 1.2.2 and windows 2000. The question is that when you go to the desktop right click properties and in Effects tab you uncheck the 'Show Window Contents While Dragging' checkBox. Now when I run my application and my parent window that is a frame pops up, if I drag the window i.e. my parent frame it doesn't dragg the contents onlt thw windows border is dragged, means it doesn't repaints that is fine. But when I try to drag one of the internal frame it shows me the contents inside the internalFrame being dragged too and I don't want to see these contents while internal frame is being dragged. So how can I make my application not to show the contents inside the JInternalFrames not to be shown while dragging the JInternalFrame. Any help is really appreciated.
    for an example I have added a code example to see the effect that I got from the forums just for an example to show. If you have unchecked the option 'Show Window Contents While Dragging' in Effects tab when you go to the desktop right click properties and the Effects Tab or in the controlPanel dblClick Display and go to Effects tab and uncheck this checkBox. Now run this example and see when you drag the main window contents inside it including JInternalFrame doesn't get dragged just the boundry of the dragging frame is shown. Now if you try to drag the JInternalFrame. Contents inside that are dragged too. And I don't want this behavior. I don't want to see the contents.
    /*************** MDITest ************/
    import javax.swing.*;
    * An application that displays a frame that
    * contains internal frames in an MDI type
    * interface.
    * @author Mike Foley
    public class MDITest extends Object {
    * Application entry point.
    * Create the frame, and display it.
    * @param args Command line parameter. Not used.
    public static void main( String args[] ) {
    try {
    UIManager.setLookAndFeel(
    "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
    } catch( Exception ex ) {
    System.err.println( "Exception: " +
    ex.getLocalizedMessage() );
    JFrame frame = new MDIFrame( "MDI Test" );
    frame.pack();
    frame.setVisible( true );
    } // main
    } // MDITest
    /*********** MDIFrame.java ************/
    import java.awt.*;
    import java.awt.event.*;
    import java.io.Serializable;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    * A top-level frame. The frame configures itself
    * with a JDesktopPane in its content pane.
    * @author Mike Foley
    public class MDIFrame extends JFrame implements Serializable {
    * The desktop pane in our content pane.
    private JDesktopPane desktopPane;
    * MDIFrame, null constructor.
    public MDIFrame() {
    this( null );
    * MDIFrame, constructor.
    * @param title The title for the frame.
    public MDIFrame( String title ) {
    super( title );
    * Customize the frame for our application.
    protected void frameInit() {
    // Let the super create the panes.
    super.frameInit();
    JMenuBar menuBar = createMenu();
    setJMenuBar( menuBar );
    JToolBar toolBar = createToolBar();
    Container content = getContentPane();
    content.add( toolBar, BorderLayout.NORTH );
    desktopPane = new JDesktopPane();
    desktopPane.setPreferredSize( new Dimension( 400, 300 ) );
    content.add( desktopPane, BorderLayout.CENTER );
    } // frameInit
    * Create the menu for the frame.
    * <p>
    * @return The menu for the frame.
    protected JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();
    JMenu file = new JMenu( "File" );
    file.setMnemonic( KeyEvent.VK_F );
    JMenuItem item;
    file.add( new NewInternalFrameAction() );
    // file.add( new ExitAction() );
    menuBar.add( file );
    return( menuBar );
    } // createMenuBar
    * Create the toolbar for this frame.
    * <p>
    * @return The newly created toolbar.
    protected JToolBar createToolBar() {
    final JToolBar toolBar = new JToolBar();
    toolBar.setFloatable( false );
    toolBar.add( new NewInternalFrameAction() );
    // toolBar.add( new ExitAction() );
    return( toolBar );
    * Create an internal frame.
    * A JLabel is added to its content pane for an example
    * of content in the internal frame. However, any
    * JComponent may be used for content.
    * <p>
    * @return The newly created internal frame.
    public JInternalFrame createInternalFrame() {
    JInternalFrame internalFrame =
    new JInternalFrame( "Internal JLabel" );
    internalFrame.getContentPane().add(
    new JLabel( "Internal Frame Content" ) );
    internalFrame.setResizable( true );
    internalFrame.setClosable( true );
    internalFrame.setIconifiable( true );
    internalFrame.setMaximizable( true );
    internalFrame.pack();
    return( internalFrame );
    * An Action that creates a new internal frame and
    * adds it to this frame's desktop pane.
    public class NewInternalFrameAction extends AbstractAction {
    * NewInternalFrameAction, constructor.
    * Set the name and icon for this action.
    public NewInternalFrameAction() {
    super( "New", new ImageIcon( "new.gif" ) );
    * Perform the action, create an internal frame and
    * add it to the desktop pane.
    * <p>
    * @param e The event causing us to be called.
    public void actionPerformed( ActionEvent e ) {
    JInternalFrame internalFrame = createInternalFrame();
    desktopPane.add( internalFrame,
    JLayeredPane.DEFAULT_LAYER );
    } // NewInternalFrameAction
    } // MDIFrame
    I'll really appreciate for any help.
    Thank you

    try this:
    JDesktopPane desktopPane = new JDesktopPane();
    desktopPane.putClientProperty("JDesktopPane.dragMode", "outline");Both parameters passed to 'putClientProperty' must be strings.
    Hope this helps
    Riz

  • How do I stop firefox from showing mobile content on my desktop

    I was wondering if anyone could assist me with this problem. Firefox shows mobile content on my desktop (such as going to Yahoo Sports page) instead of desktop content on my desktop. I have tried clearing cookies and c ache, and that has not solved my problem. Thanks in advance!

    Oh, Yahoo! might have stored its decision in a cookie, or in a cached file. You probably need to clear those again. You've done it before, but just for reference:
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    Then try reloading the page. Does that help?

  • My iPod touch shows no content for music and/or videos or downloaded apps after I upgraded to IOS v5.1.1

    I downloaded the latest version of ios for my iPod Touch (v5.1.1) and my music, videos, books, and purchased apps don't appear.  In the settings it shows I've only got 9.1 GB of space available out of 28.4 GB (my iPod is a 32 GB).  Also, on the iTunes summary page for my iPod the usage bar at the lower portion of the page is all yellow showing 'other' when it use to be multi-color showing what content (apps, video, music, etc) was using up the capacity individually.  When I click on the device icon (left side of the window) it indicates all of my music, apps, video, books, etc are on the iPod but they don't show up on the actual device.  Also, the sync button (lower right on the summary page) is "greyed out" and won't let me sync.  Thanks in advance.  Terry

    An "other" that large usually indicates that the "other" included corrupted files.  Usually restoring from backup eliminated the corrupted files. However, sometimes restoring to factory settings/new iPod is required.
    To restore from backup see:
    iOS: How to back up
    To restore to factory settings/new iPod see:
    iTunes: Backing up, updating, and restoring iOS software

Maybe you are looking for

  • How can I set a value in a field before create when a New button is clicked

    Hi, I am using JDeveloper 10.1.3.1.0.3984 and JHeadstart 10.1.3.1 release 10.1.3.1.26 I have one group and there is a detail group under that group. From main group to detail group there are 3 field relating those groups. field1 field2 fieldSEQ (auto

  • How to remove an external drive from time machine backup

    In time machine I also backup to an external drive. I recently bought a new external drive and thats working fine. However, it still wants to backup to my previous drive which I dont want to use. In time machine preferences I see the old and new driv

  • I deleted my iPhone USB from network preferences. How to get it back

    I have tried: 1. Plug out the iphone from the MAC usb port. 2. Move file /System/Library/Extension/AppleUSBEthernetHost.kext to the trash 3. Restart MAC OS 4. Download the latest version of iTunes fromhttp://www.apple.com/downloads 5. Reinstall iTune

  • Archive Area Used % Testing

    Hello, - My Oracle Version 11Gr2 , RAC using ASM and OMF. - OS Name: Redhat Linux 5.5 Issue: To test the SNMP Trap settings on database control (Not Grid Control), I would like to raise the Archive Area Used % alert. This is our test environment but

  • Converting from decimal to binary to hexadecimal to octal

    hello everyone, my question is, Is there a way to get decimal input from user and print the binary, hexadecimal and octal value of that decimal? just like C does in printf command