Programmatically saving an HTML page

I have a servlet which forwards parameters to a page, where the processing is done & output displayed in the browser!
I want to save the output HTML from the servlet itself, without any interaction from the user! How to make this possible?

I want to save the HTML page on the client side itself! I tried out another way, using the URL class & used its method to save the byte stream as a HTML file. This works alright except that some JavaScript errors are robbing the page of its look & feel! :-(

Similar Messages

  • File-Save window(saving the html page by clicking a button)

    Hi,
    when I click a button, a window should open which is same as the one which appears when we click File-save.
    This should happen to save the data that is displayed on the internetExplorer, when the user clicks the submit button on his page.(ie,Saving  the html page in his desired location).
    Thanks in advance.

    Refer FileDownload and FileUpload tutorial.
    If the idea is just to save the html page, I am not sure if it is possible.
    If the idea is to save the data in the html page then you can save it as xml format or csv format. Refer to the following tutorials:
    a) FileUpload and FileDownload
    b) Web Dynpro Binary cache
    Regards,
    Subramanian V.

  • Saving an html page in a blob

    Hi, i 've posted this question on some other forums with no luck.
    I need to find the simplest way to save a submitted html page(html code along with its values) into a blob so that i can redisplay the page with its values later on(like taking a screen shot). The page is a jsp that uses a bean(i don't know if this would pose a problem).
    Thanks for any help

    1. Create a data structure that holds
    a. the html file
    b. a copy of any external resource the page needs (css file, javascript file, images, etc). These resources will have to be discovered by parsing the html.
    2. Your HTML data object needs to imlpement Serializable or Extenalizable. (do some reading if you don't know what those are).
    3. Set the Blob's data to the serialized HTML data object's data.

  • Only non html pages being saved in History; also can't change homepage

    The last time Firefox actually saved an html page in the history was May 16th. Firefox will only save pages that I visit that are non-html pages, a page that ends in .pdf, jpg, .doc, etc.
    I have tried several times messing around with options - picking don't remember history, then restarting and selecting remember history.
    I uninstalled Firefox, but kept personal data. Then I reinstalled. Still didn't work.
    I then used the reset FireFox. It only made things worse. Now I can't change the home page.
    This is Firefox 22 beta on Win 8 Pro 64bit

    Does this only happen when you close and restart Firefox or already during a browsing session?
    In case you are using "Clear history when Firefox closes":
    *do not clear the Browsing History
    *Tools > Options > Privacy > Firefox will: "Use custom settings for history": [X] "Clear history when Firefox closes" > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History
    Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

  • Vs 2013 community screws up formatting of html page when saving file

    I have seen other people having this issue with suggestions like 'Formatting and visualizations, tag specific options. However this is not solving my issue
    example
    I type the following code this way
    <asp:Panel ID="Panel1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Days Old " />
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server">
    <asp:Label ID="Label2" runat="server" Text="Days Old " />
    </asp:Panel>
    then when I hit save the code changes to
    <asp:Panel ID="Panel1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Days Old " />
    </asp:Panel><asp:Panel ID="Panel2" runat="server">
    <asp:Label ID="Label2" runat="server" Text="Days Old " />
    </asp:Panel>
    This messes with the outlining and makes it hard to see where controls like Panel2 is in the code.
    I am using a fresh install of visual studio community 2013 on a fresh install of windows 8.1 so this is not an issue with my istallation.
    I have tried setting tag Specific options with no change
    It doesn't do this every time or just on asp:panels
    I have tried adding line breaks and spaces etc. this doesn't help either.
    is this just a bug in visual studio or is there a general setting out of wack. I didn't have this problem with vs express for web 2012. but I did have it with vs express for web 2013 and community 2013

    Hi PBPuddin,
    Thank you for posting in MSDN forum.
    Based on your issue, I tried to add this code as you said into a html page and then I saved the code. I found that the code formatting of the html page did not occur like you said that in VS2013 Community.
    So to check if this issue is related to the VS2013 Community IDE, I suggest you could try to copy the  same version of the VS2013 Community setup file on other machine and then install it check this issue again.
    (1) If you still get the issue, I assume that the issue maybe related to this VS2013 Community setup file, so please download it from Microsoft official website and then install it again.
    https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx
    (2) If you did not get same issue, I suggest you could try the following suggestion to check the issue.
    (2.1) please try to open your VS in safe mode and then check if you install some add-ins in the VS IDE.
    https://msdn.microsoft.com/en-us/library/ms241278.aspx?f=255&MSPPError=-2147217396
    Or you could try to check if you install some third-party tool/ software on your machine.
    Hope it help you!
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Viewing HTML page saved  on the server from the browser

    Hi all
    In my application i am having some HTML pages saved on the server. I had given an option to the user to view the HTML page from my application. behind the scene what i am doing is that the view request will get handled by a servlet and from that servlet iam locating the HTML page on the server directory and sending the HTML page to browser by using the Servlet OutputStream. The HTML page is shown on the browser but the attached images are not shown. The images are also there in the server directory and are refered in the HTML file correctly. When i directly open the HTML file then the images are shown correctly.
    Can anyone suggest wat's wrong there.
    The code i m using is
    ServletOutputStream out=response.getOutputStream();
                        if(format.equalsIgnoreCase("pdf"))
                             logger.info("Seleted format is pdf..\n");
                             response.setContentType("application/pdf");
                        else
                             logger.info("Seleted format is html..\n");
                             response.setContentType("text/html");
    String file = ReportingConstants.URL_GENERATEDREPORTS+reportPath+itemName;
    // file : HTML file absolute path as string.
                        URL url=new URL(file);                    
                        BufferedInputStream bis=new BufferedInputStream(url.openStream());
                        BufferedOutputStream bos=new BufferedOutputStream(out);
                        byte[] buff = new byte[2048];
                        int bytesRead;
                        while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                             bos.write(buff, 0, bytesRead);
                             bos.flush();
                        }

    You have to undertsand how the browser handles images and other resources in a HTML page. In the HTML there is an image tag that has a url to an image which can be a reletive url or an absolute url (starts with a "/").
    If the url is a relative url the browser interprets the url as being relative to the url currently displayed in the address field discarding the last element of the url . So if the url in the address bar is http://www.myserver.com/myapp/mypage.html and the relative url is images/myimage.jpg, the browser will submit a request to the server for http://www.myserver.com/myapp/images/myimage.jpg
    Now let's say that you are call mypage.html from a servlet that has the url http://www.myserver.com/myapp/servlets/myservlet. Then when the browser tries to retrieve myimage.jpg it will use the url http://www.myserver.com/myapp/servlets/myservlet/images/myimage.jpg and since this is incorrect it will not be able to display the images.
    One solution to this is to change all of the image urls to absolute urls. That is the start with a slash where the slash represents the start of the url after the application domain name. For example you used an absolute url for myimage.jpg it would look like /images.myimage.jpg and when accessing the page through the servlet url (http://www.myserver.com/myapp/servlets/myservlet) the browser will discard everything after http://www.myserver.com/myapp and look for the image at http://www.myserver.com/myapp/images/myimage.jpg which is the correct url.
    A second solution is to use the HTML BASE tag which tells the browser not to interpret the image tag urls (and other resourses) using the current url in the address bar but to use the url supplied in the HTML BASE tag. The browser will still perform the same process for relative urls but now relative to the BASE tag url. Since the BASE tag url will be the same every time the page is accesssed the images should be correctly accessed no matter how the page is accessed (eg directly, using RequestDistpatcher or via your servlet)

  • Html page saving as template

    My index page (a .html page) wants to save as a template... I
    do not want it saved as a template, but the only way I can
    apparently save it is to do a "save as" rather than just save.....
    If I try to just "save" it goes to the "save as template" screen.
    Help!

    Huh? You certainly do not need to go to save as everytime.
    And what do you
    mean, anyhow?
    Besides, the suggestion you make here will destroy the link
    between this
    template page and its child pages. I think you are confused
    big time.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "phenixwars" <[email protected]> wrote in
    message
    news:g7ctu8$cbd$[email protected]..
    > hi. same thing happened to me recently. when you're
    learning you're
    > learning
    > right? anyway, just go into the code and delete all the
    areas that say
    > <!--TemplateBeginEditable or anything that says
    template anything in your
    > code
    > and then you should be able to save it without having to
    go to save as
    > everytime.
    >
    > hope it works
    >

  • Generating PDF-files from HTML-page saved as Unicode?

    I have followed this Quick Start on how to generate a PDF-file from HTML using web services in .NET: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000093.html
    It works just fine when the html-page is saved as ANSI, but when it's saved as UNICODE I get problem. The code runs without errors but the PFD looks really strange. Any suggestions on how to solve this? I really need to use UNICODE as my application needs to handle different languages (including for example Chinese).

    I found out that UTF-8 worked as well so the problem is solved. :-)

  • Question on saving html page into excel

    hi all,
    i have one problem. Is there any ways that i can save a html page into excel??? that is to save the data displayed on the html page into excel spreadsheet.
    thanks for your advice.

    Even if you need to click a button to parse the page to a parser, you still need to transmit the page back to the server to process, unless you want the client to do it, in which case he/she will have to need a program.
    Given by the views floating around in this forum, the idea is that doing a re-query is as costly if not less costly than re-submitting the html page. By relegating to the back-end processing of data using the database, you can ensure the data is up-to-date and you can control the programs executing. That is, you are not worried about user submitting garbage html page for you to process.
    If you data size is not large, there is always the session memory to use but it's not really wise as your server's memory is much costlier than network bandwidth. It's the whole server becomes slow versus your DB connection slow.
    If you really need to use the re-submitting of your html page back to the server to process, you can always use hidden form values in html to post your data back. However, I can't remember whether there's a limit to the amount of data you can post. Think it's 1024K or something.

  • How to display a text file in a html page?

    I have written a servlet that executes a batch file whose output is saved to a txt file. I am attempting to display content of the text file as a html page from the servlet but am struggling I have attempted to read the file and output it as shown below but it is not displaying the correct data
    Appreciate some help
    Thanks in advance
    Amjad
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("C:\\Condor\\test\\QueStatus.bat");
    PrintWriter out;
    String title = "Que Status";
    response.setContentType("text/html");
    out = response.getWriter();
    FileReader fr = new FileReader ("C:\\Condor\\test\\output.txt");
    for (int chr = fr.read(); chr != -1; chr = fr.read()){
         out.print(chr);
    }

    Couple of things. First you should search the forums for how to properly exec a dos batch file. There are some problems you may run into especially with io. I suspect you may not actually be running that batch file at all.
    I would test outputing a text file separately from execing the batch file.
    Here is some code so you don't have to output 1 char at a time. Setting the content length and closing the output stream might help.
    File downloadFile = new File("c:\\blah\\blah\\blah");
    response.setContentLength((int)downloadFile.length());
    response.setContentType("text/html");
    ServletOutputStream out = response.getOutputStream();
    FileInputStream fis = new FileInputStream(downloadFile);
    byte[] buffer = new byte[1024];
    int bytesRead;
    while ((bytesRead = fis.read(buffer)) != -1) {
    out.write(buffer, 0, bytesRead);
    fis.close();
    out.close();

  • How do I add to the HTML page containing an fla?

    Hi,
    My site has Flash Video that plays back in a Flash movie
    file.
    I want to put html text on the html page containing the Flash
    movie so that if a viewer doesn't have Flash, they can see a plain
    text link that sends them to a page with a Windows Media Player.
    When I attempt to add text to the html page containing the
    Flash movie, the text doesn't appear and my page changes background
    color.
    Where in the source code should I be adding my html text?
    Please indicate the insertion point below.
    Source code below or visit
    http://www.ocatillopictures.com/OcatilloFrames/Animation.html
    Thanks
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Janos-FlashPlayer</title>
    <script language="javascript">AC_FL_RunContent =
    0;</script>
    <script src="AC_RunActiveContent.js"
    language="javascript"></script>
    </head>
    <body bgcolor="#100068">
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    <p align="center"><font face="Wingdings 3" size="16"
    color="#80dbf9" letterSpacing="0.000000" kerning="1"><a
    href="
    http://www.ocatillopictures.com/FinalPages/Animation.html#Janos
    Video Anchor" target =
    "_self"><b>t</b></a><font
    face="Arial"><a href="
    http://www.ocatillopictures.com/FinalPages/Animation.html#Janos
    Video Anchor" target = "_self"><b>Return to
    Menu</b></a></font></font></p>
    <p align="center"><font face="Arial" size="16"
    color="#80dbf9" letterSpacing="0.000000" kerning="1"><a
    href="
    http://www.ocatillopictures.com/movie-pg/Janos-movie.html"
    target = "_self"><b>View Windows
    Media</b></a><font face="Wingdings 3"><a
    href="
    http://www.ocatillopictures.com/movie-pg/Janos-movie.html"
    target = "_self"><b>u</b></a><font
    face="Arial"><b>
    </b></font></font></font></p>
    -->
    <!-- saved from url=(0013)about:internet -->
    <script language="javascript">
    if (AC_FL_RunContent == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    AC_FL_RunContent(
    'codebase', '
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', '700',
    'height', '500',
    'src', 'Janos-FlashPlayer',
    'quality', 'high',
    'pluginspage', '
    http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'window',
    'devicefont', 'false',
    'id', 'Janos-FlashPlayer',
    'bgcolor', '#100068',
    'name', 'Janos-FlashPlayer',
    'menu', 'true',
    'allowFullScreen', 'false',
    'allowScriptAccess','sameDomain',
    'movie', 'Janos-FlashPlayer',
    'salign', ''
    ); //end AC code
    </script>
    <noscript>
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
    width="700" height="500" id="Janos-FlashPlayer" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="Janos-FlashPlayer.swf"
    /><param name="quality" value="high" /><param
    name="bgcolor" value="#100068" /> <embed
    src="Janos-FlashPlayer.swf" quality="high" bgcolor="#100068"
    width="700" height="500" name="Janos-FlashPlayer" align="middle"
    allowScriptAccess="sameDomain" allowFullScreen="false"
    type="application/x-shockwave-flash" pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    />
    </object>
    </noscript>
    </body>
    </html>

    You have the text commented out. Remove the "<!--" before
    your text and the "-->" after the text and it will show.

  • Problems with saving a html webpage under windows 7

    Hello people,
    Ik have the next problem. When I an webpage witch I have made for instanse webpage.html open and I change something in it en I wanna save this changes in my webpage I get the next message (maybe the translation is not the right one) An error occurred while accessing E:\users\name\websites\MFC936D.tmp.
    This tmp file has every time a different name. The site is not saved (webpage.html) but the html page disapeares when I click the eroor message away. And the tmp file displays in the map where the files are being saved.
    My dreamweaver cs4 runs under windows 7
    I hope someone can help me.
    Thanks a lot.
    Bart

    E: is another partition were I save my data too.
    The file is maybe read only you say. But 2 things sometimes it saves right after I have tried it a few times. And second I have started dreamweaver with administration rights, so you think he has all the rights. But the sme thng happened.

  • How to send html page in outlook wihtout gibberish

    i have html page that i tried to send in outlook with send web page by email
    the problem is it add the following thing before the html:
    ן»¿
    the questions are:
    from where does it come from? and how to fixed it so it does not show?

    thank you for the answer but saving it as ansi or unicode make things worse and in that encoding
    it is not possible to see the page
    the page is mainly photos some text and links
    is there any other
    possibility that cause this or it is only encoding of the page? 

  • Why is the formatting missing from my html page created from a template?

    Hi All!
    Hope you can help me.
    I've created a new template in dreamweaver - all good. When I preview the template page in a browser everything looks perfect.
    But when I create a new html page from that template, even though the page looks perfect in design view, all the formatting is missing when I preview it in a browser.
    The site settings were relative to the site root and I've changed that to be relative to the document (not sure if that should make a difference). Either way, it hasn't changed anything.
    Any ideas?

    The site settings were relative to the site root
    If you have not enabled "Preview using temporary files" in your PREFERENCES then site root relative links will fail on preview. Why? Because site root relative links *always* begin with "/", and when the browser sees that, it (since it knows nothing about Dreamweaver sites) correctly looks for the path starting from the root of your hard drive, not the root of the DW site. When you enable preview using temp files, before handing the file to the browser, DW obligingly converts all root relative links to document relative links (which *will* work on preview) but to do that it must create a temporary file (there are other things that happen as well, like external files being embedded in the code for the preview, but that is not relevant to this discussion). The reason a temp file is created is so that these changes don't affect your saved file.
    So, if you want to use site root relative links, and do previews of your pages, you must enable the temporary files in preview. There is really no downside to doing this except that you may occasionally see a curious file named xzys139(.html in your local file list - this is a temporary file that was handed to the browser for preview, and for whatever reason was not deleted. In fact, this can save your bacon sometimes because it gives you a 'backup' of that page to which you can revert in the event of something catastrophic.
    In the larger picture, there is no benefit to using site root relative links UNLESS you are also using server-side includes. It will make your life a bit simpler if you do not use them.
    Finally, having made those links in your template file with the site root relative option enabled, changing that option to document relative will only affect NEW links, not existing ones. This is why Ken asked to see the link in your template - it's because he knows that even though you have made the option change, that old link will not be affected and will therefore fail on preview (assuming you have not enabled the temp file thing).

  • Can a menu link to .html pages?

    I want to make a DVD that will start with a video introduction, and upon finishing the brief minute or so intro, it will display a menu screen.
    1.) I would like the menu buttons to link to .html pages saved on the DVD. So after clicking on a link from the menu, it will open up a full-screen .html page.
    2.) Each .html page will link to other .html pages and have embedded images, and short quitcktime video clip links that will open up in small windows when links are clicked.
    3.) I need to have a link on each .html page that links back to the main dvd menu.
    Can this be done? Any issues with doing something like this?
    Thanks in advance for any advice!!!!

    Mark - you need to read up on DVD@ccess if you intend doing this through DVDSP. Yes, it is all possible, but you haven't quite got the way it works correct.
    What happens is you embed a URL into a menu. When the menu is accessed (typically by a button from a previous menu) the link is activated and the resource is launched. This opens in a window in front of the DVD playback window. The DVD player continues to run in the background - so you need to allow for that when returning. The viewer will simply close the web browser window and be back at the DVD window - by then you should have made the @ccess menu 'time-out' and return to the previous menu.
    You set up the HTML file (or whatever file you are using) in a folder on your Mac, and place it all within a parent folder. From within DVDSP you then use the property Inspector for the disc itself (click not he disc icon in the outline view) to specify a ROM folder. You browse for the parent folder you just created. Everything inside that will get added to the root level of the DVD, which is why you place your HTML inside a folder within that parent folder (unless of course, you don't mind your HTML file/s being scattered all over the root of the DVD).
    You set the URL for the @ccess link by using the following path format:
    file:///DVDname/ParentFolderName/filename.extension
    So if your html file is called 'index' and it is in a folder called 'ROM' on your DVD called 'Project' then the URL you set in the menu would be:
    file:///Project/ROM/index.html
    This should then get activated (as long as you have enabled DVD@ccess links in your DVD Player software).
    However, there are some caveats.
    Whilst this will work quite well on a Mac, a PC user will have a wildly varied experience - for some the links will work. For some the links won't work, and for some, all links will launch the moment the first link is encountered... ALL PC users will need to install the DVD@ccess software (which will be on the built DVD by default (DVDSP includes it there for you), unless they have already done so previously (unlikely).
    In order to maximise the experience for PC users and Mac users you should consider using Sonic's 'eDVD' to add the hyperlinks. This makes use of the Interactual player which has a far higher installed base in PCs, but will need installing in Macs. Again, this gets included on the disc when you use eDVD.
    eDVD is a PC only app - you'll need to build your project and transfer the VIDEO_TS folder to a PC, add the links and then burn it to disc or use software such as Gear Pro to create a DLT. Hopefully Jim (WTS) will see this and give more advice on how to use eDVD.
    Getting DVD@ccess working on a PC is a tricky thing to do - a lot depends on the PC software spec, and since you can't govern the user's choice in this, you are walking a tightrope of compatibility.
    Of course, you could simply set some text into your menu to say that there is additional content on the disc, and let the user browse to it at their leisure instead of relying on embedded links...

Maybe you are looking for