How to put a carriage return in a String

I am creating an error message on my class which is called and displayed on my JSP page.
In my string I want it to do a Carriage return. I used a \n however it just ignores it when displayed in JSP using scriplets.
Class declaration:
-- Want this line to start on the next line..
/** Used for the Error message for a text box. */
private final String TEXTBOX_ERROR_MSG = "\n NOTE: The text box characters left count may not be accurate.";
Used in getDBErrors() method:
--errors is an array of error records displayed in the JSP
if(this.notes != null && this.notes.length() > 4000)
     errors.add("Notes Tab: Notes section cannot be greater than 4000 characters." +  this.TEXTBOX_ERROR_MSG);
JSP Page code:
--Get the list of Errors from the class
List pbrDBErrors = editBean.getDBErrors();     
-- Display errors:
for(int l=0; l<pbrDBErrors.size(); l++)
%>
<li>
    ----------- Display ERROR Message Here
    <%= (String)pbrDBErrors.get(l) %>
</li>
<%
} %>++++++++++++++++++++++++++++++++++++++++++++++++++++++++
All the code works great - Its just the TEXTBOX_ERROR_MSG is displayed on the same line as the rest of the message and it scrolls off the page.
How do it get it to do a cariage return?? \n does not seem to work.
Thanks

I learned something new today.. I guess I can go home :)
I am creating an error message on my class which is
called and displayed on my JSP page.
In my string I want it to do a Carriage return. I
used a \n however it just ignores it when displayed
in JSP using scriplets.
Class declaration:
-- Want this line to start on the next line..
/** Used for the Error message for a text box.
private final String TEXTBOX_ERROR_MSG = "\n NOTE:
The text box characters left count may not be
accurate.";
Used in getDBErrors() method:
--errors is an array of error records displayed in
the JSP
if(this.notes != null && this.notes.length() >
4000)
errors.add("Notes Tab: Notes section cannot be
ot be greater than 4000 characters." +
this.TEXTBOX_ERROR_MSG);
JSP Page code:
--Get the list of Errors from the class
List pbrDBErrors = editBean.getDBErrors();     
-- Display errors:
for(int l=0; l<pbrDBErrors.size(); l++)
%>
<li>
----------- Display ERROR Message Here
<%= (String)pbrDBErrors.get(l) %>
</li>
<%
} %>++++++++++++++++++++++++++++++++++++++++++++++++++++++
++
All the code works great - Its just the
TEXTBOX_ERROR_MSG is displayed on the same line as
the rest of the message and it scrolls off the page.
How do it get it to do a cariage return?? \n does not
seem to work.
ThanksThanks the <br> worked great....

Similar Messages

  • How to add a carriage return

    Hi
    How to add a carriage return after Survey Type, so that the Channel Time will start from column one.
    Thanks,
    Steve
    Solved!
    Go to Solution.
    Attachments:
    Write.vi ‏39 KB

    try something like the following draft. (not tested, so modify as needed).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Write-MOD.vi ‏32 KB

  • How do you insert a carriage return into a string ?

    Hi,
    I don't know how to insert a carriage return, \n ,into a string
    without the carriage return being interpeted. I am trying to build
    a string called queryVariable from the file below so that it equates
    to the necessary format for JDBC to execute the query.
    SQL script file:
    declare @x datetime
    select @x = null
    exec OSVBAK01...demand_dump PRODUCT,FULL,@x
    go     
    required string format for query:
    "declare @x datetime\n"+"select @x = null\n"+
    "exec OSVBAK01...demand_dump PRODUCT,FULL,@x";     
    void Readfile(String path, String infilename) {
    try {
    File file = new File(path + infilename);
         if (!file.exists()) {
         System.err.println("File not found");
         BufferedReader in = new BufferedReader
    (new FileReader(file));
         String str;
         String queryVariable = "";
         StringBuffer sb = new StringBuffer();
         while ((str = in.readLine()) != null) {
         sb.append("\"").append(str).append("\n\"")
    .append("+");                              
         in.close();
         queryVariable = sb.toString();
         System.out.println(queryVariable);
    } catch (IOException e) {
         System.err.println(e.getCause());
    queryVariable equates to the following after running the code above:
    "declare @x datetime
    "+"select @x = null
    "+"exec OSVBAK01...demand_dump PRODUCT,FULL,@x
    "+"go     
    "+
    Any assistance anyone could provide would be greatly appreciated.
    Thanks for your time,
    YAM-SSM

    Interesting... that would mean, of course, that in the case of concatenating string literals (outside of loops, as they say), the compiler is optimizing the code to avoid the need for using StringBuffers internally. Actually, it's good to know this, as I wasn't aware of this optimization.
    However, the post wasn't meant to be serious... I hoped that was obvious. Everyone's spouting off nearly the same thing for adding strings and line separators and whatever.

  • How can i put three carriage returns (ENTERs) in this script's output?

    I have a script like
    begin
    select tablename list;
    dbms_output.put_line(q'[Altering selected tables' datalength]' );
    for i in 1..x loop
       execute immediate v_sql;
    end;While executing this in SQL*Plus, the output currently looks like
    Altering selected tables' datalength
    ALTER TABLE EMP MODIFY (ENAME VARCHAR2(30 CHAR ))
    ALTER TABLE DEPT MODIFY (DEPTNO VARCHAR2(30 CHAR ))
    ALTER TABLE ARCHIVE_CNG  MODIFY (TMAT_ENABLED CHAR(30 CHAR ))
    .But i need three ENTERs (Carriage Returns) after the text Altering selected tables' datalength.
    ie the output should look like
    Altering selected tables' datalength
    ALTER TABLE EMP MODIFY (ENAME VARCHAR2(30 CHAR ))
    ALTER TABLE DEPT MODIFY (DEPTNO VARCHAR2(30 CHAR ))
    ALTER TABLE ARCHIVE_CNG  MODIFY (TRIGGER_ENABLED CHAR(30 CHAR ))
    ALTER TABLE ARCHIVE_CONFIG MODIFY (USER_ID VARCHAR2(30 CHAR ))
    .

    user659394 wrote:
    What is the difference between a carriage return and a newline ? Aren't they both the same?
    Edited by: user659394 on May 13, 2009 10:28 AMThey are different characters, one is chr(13) and the other is chr(10). Many editors will treat them the same but by default, when you hit the Enter key on your keyboard the character generated depends on your operating system
    Mac chr(13), unix chr(10), windows chr(13)||chr(10)
    That's basically the difference between an ascii and a binary transfer between machines with different operating systems. In a binary transfer nothing is changed in the transfer. In an ascii transfer carriage return/newline characters are converted to the default for the operating system.

  • Interactive Report: how can I display carriage returns?

    Hello everybody.
    Here is my problem: I created a table containing a field COMMENT varchar2(4000) and using APEX 4.1 I built an interactive report on it.
    Users can fill the field COMMENT with sentences on different rows, ex:
    " this is the first line
    this is the second line
    this is the third line"
    This is correctly managed in the FORM, where I defined the field COMMENT as 'Text Area', but in the REPORT I wasn't able to set it in a way which permits to see it whit the carriage returns: the content is displayed on one row only : "this is the first linethis is the second linethis is the third line".
    I tried and set all the possible field types, but I found no ways to display the content exactly as it is (with carriage returns).
    Obviously I cannot use HTML
    , since I cannot ask users to digit it when inserting their text.
    Could someone suggest me how to reach this result? In need to use the interactive report because the searching/filtering tool is fundamental.
    Thanks in advance,
    Daniele

    >
    Please update your forum profile with a real handle instead of "user9211286".
    Here is my problem: I created a table containing a field COMMENT varchar2(4000) and using APEX 4.1 I built an interactive report on it.
    Users can fill the field COMMENT with sentences on different rows, ex:
    " this is the first line
    this is the second line
    this is the third line"
    This is correctly managed in the FORM, where I defined the field COMMENT as 'Text Area', but in the REPORT I wasn't able to set it in a way which permits to see it whit the carriage returns: the content is displayed on one row only : "this is the first linethis is the second linethis is the third line".
    I tried and set all the possible field types, but I found no ways to display the content exactly as it is (with carriage returns).
    Obviously I cannot use HTML
    , since I cannot ask users to digit it when inserting their text.
    Could someone suggest me how to reach this result? In need to use the interactive report because the searching/filtering tool is fundamental.Use a CSS style sheet with attribute selectors. Put this in the page HTML Header, replacing the <tt>T_EMP_NAME</tt> etc selectors with the actual <tt>id</tt> attributes of your column headers:
    <style type="text/css">
    .apexir_WORKSHEET_DATA td[headers="T_EMP_NAME"] {
      white-space: pre;
    </style>
    Interactive Report Control Break disregards HTML Header style.

  • How do we remove Carriage Return (line feed) inserted in FCC files

    Hi Experts,
    The file that we generate has a carriage return at the end.
    Is there any way in which we can remove this carriage return (line feed) from the file?
    The FCC parameters used at our end are as below:
    structure.filedNames:
    structure.fieldFixedLengths:
    structure.fixedLengthTooShortHandling: Cut
    Kindly tell us a solution ASAP.
    Thanks & Regards
    Dhwani

    Dear All,
    Let me elaborate on my query
    Consider that the files output looks like below:
    12  34  45  545 5454 UL
    23  33  43  434 4545 FG
    45  44  44  586 6535 GM
    Now there is an extra line(Carriage Return) getting inserted after the last line 45  44  44  586 6535 GM  which is not required at our end.
    The cursor of the file instead of stopping on the last character M, points to the next line.
    Can you please suggest how to remove this extra line from the files.
    I dont understan how will remove context help in this case.
    Regards
    Dhwani

  • How to find a carriage return and Line feed?

    I need to detect if a crriage retunr and line feed present on each row in my text file before allowing user to upload the text file
    I know how to remove them from each line but what I need is to detect them no removing them from file.
    Our concern is when the a row does not have carriage return and line feed.
    Is there a way to find this using CF? Please help
    thanks

    That is exactly the problem Dave, if some rows do not have line feed, they're not being inserted into DB, it skips other steps and go right to finish. It looks
    like the file is done processing.
    So I need to do early rejection to this kind of file.
    I used cfloop to catch anything else that do not follow the formatting rules.
    Here is what I already done:
    Right after the file got uploaded, I have these codes:   
    <cfloop  index="x" file="#MyFile#" >
      <CFSETMyLine = Replace(x,chr(9),"|", "ALL")>
      I'm using a few functions, such as, Left(), Mid(), Right(), etc to make sure certain rules are followed.
      Up till here, it's done and tested, everything is working.
      The only problem is when 1 or more rows don't end up with line feed and or carriage return.
      I plan to add some codes to check the end of each row for chr(10) since it is looping for every row anyway.
      If detected, process file normally otherwise stop processing.
    </cfloop>
    So this can't be done in CF?

  • How does one replace carriage returns (enter key) in text areas

    I have an address text area in one of my pages where end users are hitting enter after each part of the address. I want to replace the carriage return hex('0A') with spaces. How can I do that?

    If you're manually saving your data, you can just change your insert/update code as below:
    insert into myTable
    (myCol)
    values
    (replace(:PXX_MY_TEXT_AREA, Chr(10), ' '))
    where ...If you're building a page where you aren't directly saving your data, you can add an "on Submit/Before Computation" process that does something like:
    :PXX_MY_TEXT_AREA := replace(:PXX_MY_TEXT_AREA, Chr(10), ' ');

  • How to insert a carriage return in a varchar field

    Post Author: gilles
    CA Forum: Data Integration
    Hello,
    How do you insert a carriage return in a varchar field in BODI ? I couldn't find a function like CHAR(13)...
    Thanks
    Gilles

    Post Author: gilles
    CA Forum: Data Integration
    Thanks a lot,
    I'll upgrade to 11.7 (currently 11.5.1)
    Gilles

  • How to include a carriage return in a TestStand string variable

    Is there anyway to add a carriage return to a TestStand string variable. I am sending commands to an instrument using the Rs232 serial bus and they need to be terminated with a carriage return ie "\r". I know you can creat a DLL and return the string variables to TestStand but is there a beter way ?

    Hi Paul,
    Sorry about that, just noticed I left off the "" in my last response.
    Try "\\r".  that should solve it.
    Regards
    Ray Farmer
    Message Edited by Ray Farmer on 09-15-2005 09:14 AM
    Regards
    Ray Farmer

  • How to make a Carriage Return in a Word-Table by OLE Automation

    I generated a Table in a Word-Document by using the OLE2 Interface.
    After that I wrote a Text in the first cell of the table.
    Now I want to make a Carriage Return to write another Textline in the same Cell.
    But first i must move the cursor to the end of the Text.
    I haven't already figured that out.
    Can someone Help me?
    I tried this but then the Cursor moves to the Begin of the second Cell in the same row.
    *Writing the Text in the Cell
      GET PROPERTY OF o_cell 'Range' = o_range.
      SET PROPERTY OF o_range 'Text' = wa_anschr-ename.
    *Move Cursor
      GET PROPERTY OF o_cell  'Range' = o_range.
      GET PROPERTY OF o_range 'End' = ld_pos.
      SET PROPERTY OF o_range 'Start' = ld_pos.
      CALL METHOD OF o_range ' Select'.

    I don't know about your suggestion.
    I solved the Problem with that Method:
    CALL METHOD OF o_selection 'EndKey'
        EXPORTING
          #1 = '5'.
      CALL METHOD OF o_selection 'TypeParagraph'.
    The Parameter "5" ist the VB Constant wdline...
    Now it works and I'm happy

  • Can I preserve carriage returns in a string variable from SQL Server?

    I have an OLE data source that pulls data from sql server via a SELECT query.  One of the fields is an NVARCHAR(max) which goes into a string variable which is later used in an expression.  I am noticing that in the expression, carriage returns
    / line breaks in this field are being lost.  Does anyone know how I can preserve these in the expression?

    Thanks everyone for the suggestions.  I am certain there are both \r and \n in the database as when I print the field and then copy/paste to textedit to show the hidden characters, I can see both the CR and LF's.  
    I have implemented a workaround that is by no means elegant, but it gets the job done.
    I found that \r and \n will evaluate in an expression but if they are part of another string variable, SSIS escapes them. My workaround was to change my OLE_DB select statement (which fetches the custom SQL query) to explicitly change the hidden characters
    to '\r' and '\n' respectively:
    SELECT REPLACE(REPLACE([CUSTOM_SQL],char(13),'\r'),char(10),'\n')
    Then, in my SSIS expression, I de-escaped these characters:
    REPLACE(REPLACE(@[User::vAlertCustomSQL],"\\r","\r"),"\\n","\n")
    Now when the expression is executed, the SQL is formatted correctly and oddly placed comments in the query no longer break the query.  

  • How to insert a carriage return/line feed in a TextEdit without using wrap

    Hi,
    The string that I want to pass to the textedit is
    "Order Notes : bla bla bla
    Shipping notes : bla bla bla"
    The length of Order notes and shipping notes can vary.
    I am using wrapping. But I need to insert a line feed just before Shipping Notes so it comes on a different line inside the textedit box.
    How do I achieve this?
    Thanks in advance,
    Sachin

    Good thinking, Craig
    I didn't think of this large textarea being present there, just waiting for a question like this ...
    To sum it up for the lazy ones (cause looking at the examples is always worth it, so go do as Craig told ya g!):
    CONCATENATE
    `Order Notes : bla bla bla`
    `Shipping notes : bla bla bla`
    INTO text SEPARATED BY cl_abap_char_utilities=>cr_lf.

  • How to insert a Carriage Return + Line Feed inside a TextView UI element ?

    Hello All,
      Does anyone know how can I achieve the above scenario ? I have a string variable that collects and appeneds text messages from various BAPI calls. At the end of the process, the contents of this variable will be mapped to a textview. Problem is, the length of the string collected is way too long and hence not very readable.  I am not able to find a way to introduce a CRLF after each message is read and appended. Can anyone advise ? Thank you.
    from
    Kwok Wei

    Hi Renjith,
      So far I manage to get find a walk-around to the problem by using the TextEdit as what you have suggested. This works fine... till when you try to print it out. As you see, during printing, I need to remove the vertical scrollbar and ensure that all the text are properly displayed and I do not see any visibleFooter = false option (similar to that of a table) available to the TextEdit.
      If anyone has any suggestions or a more feasible walk around that allows me to print the entire contents in the TextEdit, that will be greatly appreciated
    from
    Kwok Wei

  • How to remove trailing carriage returns

    I have this field that has chr(10) for each line at the end, however there are 2 CHR(10) at the end
    I've tried replace but that didn't work also reading you can't use regexpr_replace with a negative value.
    e.g.
    This is line1 chr(10)
    This is line 2 chr(10)
    chr(10)
    chr(10)
    Any ideas please
    Database 10g Enterprise Edition Release 10.1.0.5.0

    Hi,
    frm40735 wrote:
    I have this field that has chr(10) for each line at the end, however there are 2 CHR(10) at the endWhen there are 2 (or more) do you want to remove all of them?
    If so:
    RTRIM (str
          , CHR (10)
    I've tried replace but that didn't work also reading you can't use regexpr_replace with a negative value.It's unclear what you mean.
    In regular expressions, a pattern can be anchored to the end of the string, like this
    REGEXP_REPLACE ( str
                , CHR (10) || '$'
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    See the forum FAQ {message:id=9360002}

Maybe you are looking for

  • How can i edit Iweb published page to open as a Popup?

    I want to edit my iWeb site so that when a link is clicked it opens a different page as a popup with no other toolbars, scrollbars etc - just the image i want to show. I found some code online (http://www.quackit.com/html/codes/html_popup_window_code

  • Mac mini (late 2014) calendar bug

    I purchased a late 2014 mac mini and I found the black dot (for indicating the app is running)  for calendar app disappeared when I closed it with the red cross. I checked the activity monitor and the app is still running in background. It's not a bi

  • Macbook Pro wake from sleep fails

    I am having problems with my Macbook Pro 15" waking from sleep. I was not having these problems until I re-installed OS X a few weeks ago, and now almost everytime I close the lid and take it home from work it will not wake up properly. It appears to

  • Transferring purchases from iPhone 3GS ?

    iTunes 10.4 says my iPhone 3GS (iOS 4.3.3) has purchased items to transfer before I upgrade to 4.3.5.  I click on File->Transfer Purchases, iTunes says "Transferring Purchases".  I wait until it finishes and click 'Upgrade" again, but it still report

  • Mail shows message count even if deleted.

    Mail shows 970 unread emails (in two accounts), however all have been read and deleted from phone. When showing empty, the MAIL APP icon still shows 970 messages. Where are they ? Thanks for your help. J