Convert Carrige Return to br in HTML

Suppose I have a form, and there is a input field of type text,and text area, I want to replace carrige return in the text area to "<br>" when the user submit his data, In ASP it is easy:
Desc = Replace(txtDesc,Chr(13),"<br>")
How I can do that in servlet?
Please Help Me

Might need to do this in ypur JAVA servlet code
txtDesc = txtDesc.replaceAll("\r\n","<br>");
In an HTML INPUT text area when user presses ENTER key, both a carriage return HEX("OD") and line feed HEX("0A") are inserted into the text area. These are represented in regexp "\r\n".
HTH
Walk Good

Similar Messages

  • Converting String to ISO-8859-1 html charset

    i want to convert string to ISO-8859-1 html charset or vice versa
    For example i need to replace "ö" as  "&#246;"
    How can i do that?
    http://www.unicodetools.com/unicode/utf8-to-latin-converter.php

    i want to convert string to ISO-8859-1 html charset or vice versa
    For example i need to replace "ö" as  "&#246;"
    How can i do that?
    http://www.unicodetools.com/unicode/utf8-to-latin-converter.php
    This seems to return #246; but not &#246; for ö. Unless the & character is not getting displayed for some reason.
    HttpUtility.HtmlEncode Method (String)
    HttpUtility.HtmlDecode Method (String, TextWriter)
    Option Strict On
    Imports System.Web
    Imports System.IO
    Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.Text = "Form1"
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim myString As String = "ö"
    Dim myEncodedString As String = HttpUtility.HtmlEncode(myString)
    Label1.Text = " " & myEncodedString & " "
    Dim myWriter As New StringWriter()
    HttpUtility.HtmlDecode(myEncodedString, myWriter)
    Label1.Text &= myWriter.ToString
    End Sub
    End Class
    La vida loca

  • How can servlet return the output as html content with drawing picture?

    Does anybody know how can a servlet return the output as html content with drawing picture?
    The drawing picture is drawn at runtime by the servlet.

    Thanks, BalusC.
    But I am not sure if I understand your reply fully.
    From my understanding, you are telling me to first generate a html from a servlet with the image <IMG> tag pointing to a servlet which will be responsible to generate an image?
    For example, <IMG SRC="http://myserver/servlet/testservlet">
    Could you confirm this?

  • Problem with added carrige returns in download of fixed length records.

    Hi,
    I'm hoping that someone can help me, I'm at a complete loss.
    I am downloading fixed length text records from our extranet via JSP. The problem is that 8 addtional carrige returns are being added to the records somewhere during this process, rendering the files useless. The following is the code I'm using
    <%
    FileInputStream fInputStream = null;
    String piccareD = "/usr/local/apache/tomcat/webapps/piccare/";
    String filePath = piccareD + "x/" + request.getRemoteUser() + "/dnload/";
    String fileName = request.getParameter("fileName");
    int ch;
    String dnloadFile = filePath + fileName;
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment;filename=" + dnloadFile);
    Connection con = ConnectionServlet.getConnection();
    try
      fInputStream = new FileInputStream(dnloadFile);
      while ( (ch = fInputStream.read() ) != -1)
          out.write(ch);
      log.logEvent(con, LogElement.DNLOAD, fileName);
      log.setRetrieved(con, fileName, tStamp.getStamp());
      if( ! (fileName.indexOf("archive/") > -1) )
           String proc = "mv " + dnloadFile + " " + filePath + "archive/" + fileName;
           Process mv  = Runtime.getRuntime().exec( proc );
           Thread.sleep(100);
           int ec = mv.exitValue();
           mv.destroy();
           System.err.println( ec );
           if( ec != 0 )
    } catch (Exception e) {
            System.err.println(e.getMessage());
            log.logEvent(con, LogElement.DNLOAD_ERR, fileName);
    %>Any help is sincerely appreciated.
    Thank you!
    [email protected]

    You might try setting the buffer size to 0 for the jsp page and see if that helps.

  • Fn:replace JSTL tag trick for replacing carrige returns....how?

    Hi
    I have some <textarea> input that I would like to format for display.
    My question is: How can I use fn:replace tag to replace carriage returns to
    so that formatted input looks like exactly as entered in by user?
    Doing string.replaceAll("\r\n|\n","<br/>"); works fine from within a servlet but not if use fn:replace.....This is what I tried
                        <c:set var="msg" value="${param.message}"/>
                        ${fn:replace(msg, "\\r\\n|\\n", "<br/>")}This doesn't work...
    I have to use double backslashes in fn:replace - otherwise I get JSTL error.
    Can someone tell me what am I doing wrong...
    Thanks

    I have some <textarea> input that I would like to format for display.
    My question is: How can I use fn:replace tag to replace carriage returns to
    so that formatted input looks like exactly as entered in by user?One misconception here: the fn:replace tag does NOT use regular expressions to do its replacement. It is a simple replace "x" with "y" function.
    <% pageContext.setAttribute("carriagereturn","\n"); %>If you're going to do this, at least use System.getProperty("line.separator") rather than assuming it is \n.
    A better solution IMO is to use <pre> tags around the text you want to print out preformatted. It avoids the whole need to convert carriage returns into <BR> tags.

  • Convert BAPI Return to Faults?

    Hi,
    For the development of Web Services, the use of Fault messages is preferred to report errors.  Proxies (Java and ABAP) can return Fault messages, that in turn can be returned through the Web Services.
    However, BAPI's are not able to return Fault messages.  BAPI's retun a 'Return' structure containing items.  <b>Is there a simple way (no BPM please) to convert these Return items of type 'E' into Fault messages?</b>
    This would lead to nice web services reporting errors back as Fault messages.
    Kind regards, Guy Crets

    hi,
    AS of SP13 this is not possoble in XI3.0 There is no way RFC Adapter automatically convets errors to fault messages.
    In fact Xi throws a hard error(Server Exceprtion) at the caller.
    Naveen

  • How to convert MS Word to XML or Html

    Now I have to do one job that convert MS Word to XML or Html. Does anyone have better ideas? Would you like share with me?
    Thanks in advance.
    Jackal

    Despite the opinions expressed by others, simply "renaming" the file will NOT "convert" it from a MS Word format into an XML format.
    As far as I am aware, the only way to do this is via the APIs that Microsoft provide. Any other mechanism you find will either be doing this, or they will be "guessing" about the construct of the file.
    Unfortunately, the APIs made available by Microsoft are primarily C++ (COM) components. So, you CAN achieve your desired result by creating a C++ "wrapper" around the MS Office COM components and exposing this wrapper to JNI. The exposure to JNI is actually quite simple, however the C++ wrapper itself (that calls the COMponents) will be a bit more challenging.
    I hope I am wrong, because I need to do the same thing and am dreading having to delve into C++ land!

  • How do I reed a carrige return from a JTextArea

    How do I reed a carrige return from a JTextArea, as i would like to hadel this with a button press event.

    Try adding a keyListener and use the appropriate method to get the key used from the passed in KeyEvent
    public void keyPressed(KeyEvent e) {
    if(e.getKeyStroke() == KeyEvent.VK_ENTER) {
    ... // the rest goes here. Please check this code for it is not tested
    }ICE

  • Does a Stream in iOS expect a Carrige Return?

    Hi all,
    i'm trying to comunicate to a device that is network enabled through a rs232 to wlan adapter. I'm able to connect to the Device and send Commands but the only thing that gets back is a *HELLO* which is sent by the Wlan module (a rv171). The device sends something back, but I don't recieve it in my inputStream! Does this Input Stream expect a Carrige Return?
    Communication works if one just uses CFSockets, which is not an option to me, since I don't understand that whole thing... (The Software that works was written by my forerunner)
    Any Help is appreciated
    Thanks very much for your Help
    sensslen

    Well I found my fault... Never close your Stream before You get an answer

  • Dynamic Converter Not Returning HTML

    Hi,
    I'm trying to call get_dynamic_conversion service using RIDC on a word document to convert it to HTML. However, the service is not returning HTML but instead hda that starts as follows:
    <?hda version="11gR1-11.1.1.4.0-idcprod1-101229T001824" jcharset=UTF8 encoding=utf-8?>
    @Properties LocalData
    computedTemplateName=
    FileFormat=application/vnd.openxmlformats-officedocument.wordprocessingml.document
    RIDC Call:
    IdcClientManager manager = new IdcClientManager();
    IdcClient idcClient = manager.createClient("idc://localhost:4444");
    IdcContext userContext = new IdcContext("weblogic");
    DataBinder binder = idcClient.createBinder();
    binder.putLocal ("IdcService", "GET_DYNAMIC_CONVERSION");
    binder.putLocal ("dDocName", dDocName);
    binder.putLocal ("RevisionSelectionMethod", "LatestReleased");
    ServiceResponse respuesta = idcClient.sendRequest (userContext, binder);
    String html = respuesta.getResponseAsString();
    I can see the content item is been converted to HTML in the UCM and labelled as "Get Conversion". I'm also getting the html output when I access the content item as follows in the browser but in the application via RIDC.
    http://localhost:16200/cs/idcplg?IdcService=GET_DYNAMIC_CONVERSION&RevisionSelectionMethod=LatestReleased&dDocName=xxx_002
    Thanks,
    Raj

    Hi
    IdcService", "GET_DYNAMIC_CONVERSION need to be accompanied by the dID of the content that has to be HTML formatted .
    Thanks
    Srinath

  • Converting carriage return in HTML spool

    I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
    The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
    This is the script:
    set pagesize 10000
    set scan off
    set markup html on spool on head ' - '
    column text heading "TEXT"
    spool c:\temp\report.html
    select dbms_lob.substr (t.field, 5000, 1)     text
    from table t;
    spool off;
    exit;
    The "field" contains a long text with carriage returns that aren't in the report.html anymore

    user12180597 wrote:
    I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
    The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
    This is the script:
    set pagesize 10000
    set scan off
    set markup html on spool on head ' - '
    column text heading "TEXT"
    spool c:\temp\report.html
    select dbms_lob.substr (t.field, 5000, 1)     text
    from table t;
    spool off;
    exit;
    The "field" contains a long text with carriage returns that aren't in the report.html anymoreset preformat to ON:
    set markup html on spool on head ' - ' PRE ON

  • How to dynamically convert the return  datatype of a procedure

    Hi ,
    I want to write a procedure which will take two argument.
    one will be string and another one will be a out variable having dynamic return type based on the data in first passing parameter.
    Description:
    let suppose i have one table which has 3 column
    1.String_col1 varchar2 (it will contain String combination of alphabets,numbers)
    2.number_col2 varchar2 (it will contain numbers only)
    3.date_col3 varchar2 (it will contain DATE)
    All columns are having varchar2 as their datatype.(in sort all are String).
    now i want to write a procedure which will convert the datatype of all the three columns into their respective datatypes i.e.
    1.String_col1 varchar2
    2.number_col2 number
    3.date_col3 date
    Note:I am passing only 1 column in procedure as IN parameter.I dont want to convert 1 row in their respective datatype.
    Please let me know if you want any more information from my side.

    I'm pretty sure that isn't possible.
    What you could do is write a function to determine the datatype of the input, and use the return value of that function in either a decode or case statement to determine which of 3 explicitly defined functions to use.
    Carl

  • How can I convert a Flare project to RoboHelp HTML 10?

    In my company, we work in RoboHelp HTML 10. We aquired a company that uses Flare for their online help project, and now it falls to me to convert it to RoboHelp. I searched online and found the converter on the Show Me The Demo site, but the download button doesn't do anything.
    Is that converter posted anywhere else? Or is there another method of converting from Flare to RoboHelp? Any help would be appreciated.

    Hi folks, sorry for the glitch in the download for the Flare to Robohelp Project Converter. I have been traveling and teaching and did not notice this post.
    Until I fix the link, please email me using the address in my Profile and I will send it via an email attachment right away.
    Sorry for the inconvenience.
    John
    John Daigle
    Adobe Certified RoboHelp and Captivate Instructor
    Evergreen, Colorado
    www.showmethedemo.com

  • How do I convert a PDF with links to html?

    I created a JPEG in Photoshop elements 9 and then used acrobat to overlay some links on the Jpeg.  I then saved the jpeg as a PDF.   How to convert this file to HTML so I may upload it to the web with all links active and original jpeg intact? 
    Having a really hard time with this! 
    Do I need to purchase a separate program?

    In my experience, there's not much you can do outside of copying and pasting page by page.

  • How do i convert a pdf file into a html file?

    need help with question

    Hi Wolfie1234,
    You can use Acrobat 11 to convert a pdf to html.
    Launch Acrobat. Click on File > Save as Other > HTML Web Page

Maybe you are looking for