Java Html generation encoed newlines correctly

Hello,
I am generating an html string with some java code, and for some reason the newlines are's kept or encoded correctly. I tried using "\n" at the end of my lines, and I even tried using :
final String newLine = System.getProperty("line.separator");with no luck. I am using a StringBuffer to create the html page, one line at a time with the append(String) method. I tried writing it (the html file) using the UTF-8 encoding and made sure my html declaired it uses the same encoding, doesn't work. This wouldn't bother me much but when I try to validate the HTML using the w3 validator it has problems with the page, like not detecting the Doctype even though there is one, and I beleive this is why I get other strange errors. Firefox does detect the correct encoding, but when I look at the source using Firefox and IE I have no newlines.
Does anyone have any ideas?
Thanks!

Sure, here are parts (the whole thing is too long) :
      StringBuffer htmlText = new StringBuffer();
      htmlText.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      htmlText.append("<html>\n");
      htmlText.append("  <head>\n");
      htmlText.append("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      htmlText.append("    <!-- #1 Html Title -->\n");
      htmlText.append("    <TITLE>" + getHtmlTitle()  + "</TITLE>\n");
      // CSS
      htmlText.append(getCss().toHtml());
      htmlText.append("  </head>\n");
      // More html code...
      String html = htmlText.toString();
      try {
         BufferedReader in = new BufferedReader(new StringReader(html));
         BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(TMP_WORKING_DIRECTORY_ROOT_DIR +
               File.separator + filename), "UTF8"));
         String thisLine = "";
         while ((thisLine = in.readLine()) != null)
            out.write(thisLine);
         out.flush();
         out.close();
         in.close();
      } catch (IOException e) {
         log.writeToLog(SendPanel.class, "Writing html file failed!");
         e.printStackTrace();
      }could it be that my in.readLine() strips the newline/EOL char?

Similar Messages

  • Java Proxy Generation not working - Support for Parallel Processing

    Hi Everyone,
    As per SAP Note 1230721 - Java Proxy Generation - Support for Parallel Processing, when we generate a java proxy from an interface we are supposed to get 2 archives (one for serial processing and another suffixed with "PARALLEL" for parallel processing of jaav proxies in JPR).
    https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1230721
    We are on the correct patch level as per the Note, however when we generate java proxy from the IR for an outbound interface, it genrates only 1 zip archive (whose name we ourselves provide in the craete new archive section). This does not enable the parallel processsing of the messages in JPR.
    Could you please help me in this issue, and guide as to how archives can be generated for parallel processing.
    Thanks & Regards,
    Rosie Sasidharan.

    Hi,
    Thanks a lot for your reply, Prateek.
    I have already checked SAP Note 1142580 - "Java Proxy is not processing messages in parallel" where they ask to modify the ejb-jar.xml. However, on performing the change in ejb-jar.xml and while building the EAR, I get the following error:
    Error! The state of the source cache is INCONSISTENT for at least one of the request DCs. The build might produce incorrect results.
    Then, on going through the SAP Note 1142580 again, I realised that the SAP Note 1230721 also should be looked onto which will be needed for generating the Java proxy from Message Interfaces in IR for parallel processing.
    Kindly help me if any of you have worked on such a scenario.
    Thanks in advance,
    Regards,
    Rosie Sasidharan.

  • How to make a horizontal line in java html browser?? without hr

    I use java html browser
    I want to make a black horizontal line
    the <hr> line is not good
    for my customer it seems that there is a double spacing in this case
    I tried to write
    <td style = "BORDER-BOTTOM: 1px solid #000000"> ...
    but it does not work
    I suppose this style is not supported by the default StyleSheet
    I tried to write
    <td bgcolor="black" height=1>
    but the table has all rows with equal sizes
    therefore the real height is too big
    Please help me
    I tried to write
    <table border="1">... </table>
    even in this case I have table without any border

    Hi,
    the best way might be to use a blind table with all cells set to have a border on the bottom. The problem is that the standard Java runtime does not render such setting automatically. There is plenty of work involved to adapt it and still it then would work only in the adapted version and not the standard runtime environment.
    Anyway, you can find a working example of how to accomplish individual borders around table cells in open source application SimplyHTML at http://www.lightdev.com/dev/sh.htm
    Ulrich

  • Error in java proxy generation due to xs:choice tag

    Hi all,
    I'm trying to generate a java proxy in the SAP XI design.
    The message interface I'm using is based on an external definition which i imported from an xsd file.
    The problem is that XI doesn't allow me to generate the java proxy because in the xsd schema the tag <xs:choice> is present and XI cannot handle it (just in this case, because the external definition works fine).
    Does anybody know how to solve the problem or manage to generate the javaproxy anyhow?
    Thanks in advance,
    Daniele

    > Replace <xs:choice> tag with  <b><xsd:choice> tag
    > </b>
    > that should solve the prob.
    I tried to change the tag (replacing also other <xs:...> tags in order to obtain a valid xsd) but the problem didnt change.
    i'm almost convinced that tag is not supported in java proxy generation (but it is for external definitions...)

  • UTF-8 csv file generated by Java can't be displayed correctly on Excel 2000

    Hi, I have a question about the file geneated by Java in UTF-8 format. If I have a file named "foo.csv" generated by my java code like this:
    writer = new OutputStreamWriter(new FileOutputStream("foo.csv"), "UTF-8");
    Then I write some data loaded from a MS SQL 2000 server to this file. Some data are in German or french characters. After the file is generated, if I open it in notepad, all the characters in the file looks good. The file is in UTF-8 format. The only problem is that when I open this csv file in MS Excel 2000, all the non-english character display incorrectly. For example:
    "VERKTYGSTEKNIK I V�XJ� AB" display as itself in notepad, but it display as "VERKTYGSTEKNIK I V��XJ�� AB" in the MS Excel. I don't know the reason. If I don't have the encoding in the writer, then the file generated looks fine in the Excel (Even the non-English characters), in this case, the file is generated in ANSI format. But my client wants the file in UTF-8 format and also want to view it in Excel.
    Why the UTF-8 file generated by Java can't be displayed correctly in Excel 2000?
    My environment is:
    OS: Window 2000 Server English Version
    JDK: Sun jdk1.3.1
    Thanks

    - Does ms excell actually support UTF-8
    Yes. I believed that we installed some international add-on which is not in default installnation. Anyway, other UTF-8 or UTF-16 file can be openned and viewed by Excel without any problem.
    - have you verifide that the file is viewable as a UTF-8 -encoded file
    I think so. If I open it into Notepad and choose "save as", the file type if UTF-8 file
    - Try opening the file in a program you are confident
    that it support UTF-8 - eg. Mozilla...
    I will try that.
    - Check that your UTF-8 -encoded file has a UTF-8 identifier (0xFEFF ?)
    as the first character
    The unicode-16(LE or BE) file I got from internet, I found there is always two bytes in the front. (0xFEFF or 0xFFFE). My UTF-8 file generated by java doesn't have that. But should UTF-8 file also has this kind of specifcal bytes in the front? If I manually add these bytes in the front of my file using Ultraeditor and open it in Excel2000, it didn't help.
    - Try using another spreadsheet program that supports UTF-8
    Do you know any other spreadsheet program supports csv file and UTF-8.

  • Dynamic HTML generation from a Dynamic PDF/XDP

    I was wondering if LiveCycle is able to generate a dynamic HTML page from a dynamic XDP/PDF form in LiveCycle ES ?
    I have read up on the help contents regarding HTML generation from PDF forms but its not mentioned anywhere whether LiveCycle supports the creation of an HTML page that mimics the dynamic behavior of a dynamic PDF/XDP form.
    Thanks in advance

    Yes it does ....
    Paul

  • Synchronous interfaces missing in Java proxy generation

    Hi,
    In PI 7.1 ESR, in "Java proxy generation" wizard, it only lists the Asynchronous interfaces from the software component version. None of the synchronous interfaces are listed.  how can I solve this? I need to generate a java proxy for a syncronous interface.
    thanks and regards,
    Raghu

    Make sure that the inteface pattern is "stateless (XI 3.0 compatible)".

  • Difference between Analyzer Java & HTML Client

    Hi,Does anyone know all the differences between Analyzer Java & HTML Client.A couple of diffence I noticed are:1. HTML Client doesn't support Linked Reporting Objects (LRO)2. HTML Client doesn't seem to support Navigate functionality in Java client.Are there any more differences ?TIA.

    http://download.oracle.com/docs/cd/E11882_01/install.112/e10876/toc.htm
    Pertains to the client installation.
    This guide describes how to complete a default installation of Oracle Database Client in a new Oracle home directory. It describes how to perform one of the following installation types:
    Instant Client: Enables you to install only the shared libraries required by Oracle Call Interface applications that use the Instant Client feature. This installation type requires much less disk space than the other Oracle Database Client installation types.
    Instant Client includes Instant Client Light. You may want to use this version of Instant Client if your applications will generate error messages in American English only. The advantage of using Instant Client Light is that it has a smaller footprint than regular Instant Client: its shared libraries, which your applications must load, are only 30–32 MB as opposed to the 216 MB that regular Instant Client uses. Hence, your applications use less memory.
    Administrator: Enables applications to connect to an Oracle database on the local system or on a remote system. It also provides tools that let you administer an Oracle database.
    Runtime: Enables applications to connect to an Oracle database on the local system or on a remote system.
    Custom: Enables you to select individual components from the list of Administrator and Runtime components.
    "

  • Print this Page Java html snippet

    I decided to try adding the above to one of my pages in iWeb.
    I added the java code as shown on Old Toad's site:-
    <form>input type="button" value=" Print this Page "
    onclick="javascript:parent.window.print();return false;"/></form>
    I placed this code in an html snippet in iWeb and applied it and it showed up as Print this Page in the site. I then published the site to a local folder and uploaded the changed pages to my external server. After uploading, I visited my site and tried clicking on the button and it did not work.
    Anyone know why it did not work? The code is correct and I copied and pasted from OT's site directly into an html snippet.
    Is the code site or page specific or generic, that it will work for any site?
    Does it only work in MobileMe published sites and not for sites uploaded to an external server?
    Any insights gratefully received.

    Does the print button work when the site was on your HD locally? Here's some different code that you might try:
    <SCRIPT LANGUAGE="JavaScript">
    // This script was supplied free by Hypergurl // <a class="jive-link-external-small" href="http://www.hypergurl.com">http://www.hypergurl.com</a> <!--
    hide script and begin if (window.print) { document.write('<form>Click Here
    To ' + '<input type=button name=print value="Print" ' + 'onClick="javascript:window.print()">
    This Page!</form>'); } // End hide --> </script>
    The original code should work on any server as far as I know. Cyclosaurus is the authority on javascript and should have an answer.
    This Google search has numerous examples of code:http://www.google.com/search?hl=en&safe=active&client=safari&rls=en-us&ei=MBCjSd X6LoK2sQOIj8zGCQ&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=javascriptto+printpage&spell=1

  • What is a html generation class in UIX?

    There's a site which is used OAF.
    But some pages are not rendered well.
    The problem is caused by "<oa:messageFileUpload>" tag in XML file.
    PC browser renders it properly, but ie mobile 5 couldn't render it well.
    However in html source, it is showed as "<input type=file>" tag, and this html tag can be rendered in ie mobile.
    So maybe UIX has some problems in a part of html code generation.
    I want to modify and apply it.
    Someone can help or advise me?

    Simply Singleton
    Use your singletons wisely
    When is a Singleton not a Singleton?
    Java Glossary : singleton
    How can I implement the Singleton pattern in the Java programming language?
    Singleton Pattern
    Java Singleton
    Using the Singleton Pattern
    Double-checked locking and the Singleton pattern

  • Is this Java Glossary entry for "static" correct?

    Hi all,
    I'm trying to understand static variables.
    This glossary: http://mindprod.com/jgloss/static.html, has several lines that I don't think are correct, but I could certainly be wrong myself.
    static final when applied to a variable is Javanese for "constant".
    All static methods are automatically final. It is not strictly speaking an error to
    mark them final, but it is redundant and considered bad form.I made a test class with a public static int x in it. I did not initialize the int. The compiler had no problems with it. I then made it a public static final int and the compiler (Eclipse, Java 1.5) complained that the int had not been initialized. Therefore, it seems to me that static and static final are different.
    They can call instance methods only if they use their own object
    references -- not rely on this.I made a class with a public static Object x. I then set x to be this in a method. The compiler had no problems with this.
    Am I misunderstanding what the author means in the two quotes above?
    Thanks!
    Tim
    Edit: Woops, the above quotes talk about methods, not variables. Shouldn't the same be true of variables, though? How can a static constant relay on 'this"?

    TimQuinn wrote:
    Hi all,
    I'm trying to understand static variables.
    This glossary: http://mindprod.com/jgloss/static.html, has several lines that I don't think are correct, but I could certainly be wrong myself.
    static final when applied to a variable is Javanese for "constant". This is correct.
    All static methods are automatically final.This is incorrect.
    public class Scratch {
      final static void foo() {}
    class ZZZ extends Scratch {
      static void foo() {}
    }Notice the difference when Sractch.foo is declared final vs. when it's not.
    I made a test class with a public static int x in it. I did not initialize the int. The compiler had no problems with it. I then made it a public static final int and the compiler (Eclipse, Java 1.5) complained that the int had not been initialized. Therefore, it seems to me that static and static final are different.Yes, they are.
    Note, however, that final means something different for a variable than for a method, and that Roedy was talking about both in the same paragraph.
    They can call instance methods only if they use their own object
    references -- not rely on this
    I made a class with a public static Object x. I then set x to be this in a method. The compiler had no problems with this.Because the calling method wasn't static. He's saying a static method can call an instance method only if it has it's own reference to an instance, since there is no this in a static method. He is correct.

  • Java/HTML/Loop Question

    Hiya,
    I wasn't too sure where I should post this so let me know if its in the right place.
    Basically I am completing an online voting system using servlets. I have all the features working correctly except for one. I am totally dumstruck as to what I should put in the below ****** gap.
      out.println("<form name = vote action=ballotServlet method= POST>" +
                                "<TABLE border = 1 cellspacing = 3>" +
                                "<tr><th>Name</th><th>Description</th><th>Party</th><th></th></tr>");
                        ArrayList all = c.allCandidates;
                        for (int i = 0; i < all.size(); i++) {
                            Candidate value = (Candidate) all.get(i);
                            out.println("<tr><td>" + value.getName() + "</td>" +
                                    "<td>" + value.getDescription() + "</td>" +
                                    "<td>" + value.getParty() + "</td>" +
                                    "<td><input type=radio name=vote value= ****** ></td></tr>");
                        out.println("</TABLE>" +
                                "<p><input type=submit id=submitVote value=Submit Vote>" +
                                "</BODY></HTML>");
                        out.close();Basically, I need the value from whatever is produced in that loop (the value of the radio button) but if I assign it to a value such as value.getName..it just reads it out as this String rather than the actual value. I have tried to assign it to a seperate value also but it just doesn't work.
    Does anyone have any ideas?
    Thanks,
    welsh-diva87

    I'm not sure this is something we can answer for you. It's a design decision. You seem to be asking "How can I identify which candidate was selected when the form gets posted back to the server?"
    This identifier is whatever you want it to be. It should be some unique value for each candidate in your list, and something that won't cause problems when being URLEncoded. The name may work, in which case you could put value.getName() in your space. If that doesn't meet your needs, then use something else, even an arbitrary id string for each candidate.
    Btw, the HTML you are generating is very wrong. Your attribute values need to have quotes around them in the response. If you're in java code you could print it like this:
    out.println("<form name=\"vote\" action=\"ballotServlet\" ...{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Internal Links in HTML Document Not Working Correctly in PDF

    I have an HTML document that contains internal links (basically a Table of Contents). When the document is displayed in a browser, the internal links work correctly. However, when I use Acrobat 8 Professional to create a PDF version from the HTML source, the links don't go to the correct place when clicked. It almost appears that they are off by one, e.g., link 7 goes to anchor 8. I can send the source document for you to look at if you email me at eharris -at- synnovation.com. I am not expert in HTML and perhaps the links/anchors are not done correctly when I create the HTML document. Does anyone have any ideas on this?

    This one has the same problem. For instance, "Anchor1" as <a name="Anchor1"> appears 13 times. I am sure that your problem is that Acrobat is going to the last occurance that is just before the first one. As I scan through the file I find similar results for all of the anchors. When I used Tidy, it reduces about 1350 errors to about 474, but that is still not too good. The validator is flagging a lot of identical IDs as well as unrecognized attributes (like ONSELECTSTART). The attributes correctly accepted by body are
    Attribute Specifications
    * BACKGROUND=URI (background image for document)
    * BGCOLOR=Color (background color for document)
    * TEXT=Color (text color for document)
    * LINK=Color (link color for document)
    * VLINK=Color (visited link color for document)
    * ALINK=Color (active link color for document)
    * ONLOAD=Script (document has been loaded)
    * ONUNLOAD=Script (document has been exited)
    as listed on htmlhelp.com for HTML 4. There may be some new ones in HTML 5, but I did not check.
    I am not looking at all of your HTML in detail, but there appears to be a lot of unneeded things based on the error messages from the validator. Many browsers will let you display the stuff (even Acrobat), but there may be errors that crop in when you do not expect it or on some other browsers that the one you check. Thus again, you should use a validator. If you are only off a few tags that might be fine, but when it is in the 1000s, there is an issue. It would also be good to break your page up into parts. It is good practice on web pages for each page to be not much more than one screen. That is often exceeded, but 59 screens of info (on my screen) is a bit much. The TOC is definitely needed in that case, but just was well go to a sub page just as well and make the info easier to track. A PDF (as you are trying to get) could be made of the entire system for those that want it all in one bit. Bill

  • HTML Content not displayed correctly in UWL

    Hi all,
    I have setup UWL to connect to SRM 5.0 system. I have no problem retrieving alerts from the backend. However, alerts with HTML content are not displayed correctly in the UWL. Instead of parsing the HTML content, the html tags are displayed instead.
    Am I missing some configurations here?
    Thanks in advance.

    Hi Benny;
    Please see:
    My Oracle Support FAQ [ID 747242.5] << What are the browser requirements for accessing My Oracle Support?
    If you have still problem you can go wiht SR
    Regard
    Helios

  • HTML Form Not Displaying Correctly in Outlook 2010 (Exchange 2013)

    Hello,
    I have recently migrated to Exchange 2013. Clients are still using Outlook 2010. There is an application that automatically sends an HTML form by email for the users to fill in. The form consists of radio buttons, text areas and drop down list. However,
    in Outlook 2010, the form is not rendered properly.
    When I clicked the "If there are problems with how this message is displayed, click here to view it in a web browser" link, the email is opened in
    IE and the form is displayed correctly.
    I also tried opening the same email in other clients, such as Thunderbird, Apple Mail Client and in mobile phones - the form is displayed correctly. I wonder
    why it fails to do so in Outlook 2010. The user mentioned that this does not happen in Outlook 2003 and prior to migration (I used Exchange 2010 previously). I have also tried using OWA, but the form does not display correctly
    Any help?
    Note: I can't attach any images or links as it is mentioned that my account is not verified yet. I will post some screenshots when it is possible to do so

    Hi 
    Outlook 2007 or newer use Microsoft Word for their HTML engine.
    You can refer this page http://www.campaignmonitor.com/css/ shows
    many things that do not work in different clients.I think Someone needs to re-code
    the HTML form to make it work in the current versions of Outlook. You can try formatting with text and HTML and see the results.
    Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com Thanks Sathish
    (MVP)

Maybe you are looking for