String with new lines in sql and java

i'm using mysql as my database. In one of the columns (nameCol) stores a string, 'hello, my name is earl'
In my java app i want to display this in a text area so that it looks like:
hello,
my name is earl
in mysql i did: INSERT INTO Table (......,nameCol) VALUES(.....,'hello,\nmy name is earl'); This inserted the data into the database in the format i wanted (as above) but when i printed it in my app it came out like hello, my name is earl.
My sample code:
//some code above to set a parameter for a select statement to get a unique row
//get data from the nameCol field  ..this all works fine
String nameC = (String)nameDataProvider.getValue("Table.nameCol");
//set the text area
myTextArea.setText(nameC);Anyone know how i can get it to display in the format at the top?

Well, one reason for that is that \n not necessarily leads to a line wrap. Wrap chars are system dependant. Try using System.getProperty("line.separator") instead.

Similar Messages

  • Length of a String with new line

    Hello
    I have a Form that allows user to fill in. In that form, I have an address field (textarea).
    Now I want to know the length of this address. I uses
    String size = addressField.length();
    The size is correct if I have only one line in the address. But if I enter an adress with multi-line, the size is much more than what I count (by hand) even I add one value for each line.
    For example, if address "Wellington" has one line as:
    Wellington
    It can be seen that the size is: 10
    But if I enter this in multi lines:
    W
    e
    ll
    ing
    ton
    It can be seen that, by counting, the size is 14 (10+4=14)
    However, I get the value of addressField.length() is 18
    How I should get value for only 14
    Many thanks
    shoa

    You realize, of course, that you cannot use Javascript to execute Java code like that, right? Java runs on the server, Javascript runs in the browser, and there is no connection whatsoever between the 2. At best, you can use Java to write Javascript code into a page. But calling count() in Javascript will not execute that Java/JSTL code.

  • Splitting a string on new lines...

    If I want to split string on whitespaces, I do:
    StringTokenizer st = new StringTokenizer(a, " ");If I want to split a string on new lines, (I think the ascii values are "13", "10") how can I do it?
    Thanks a lot!

    does "\n" represents both chr(13) and chr(10) ?No, it does not.
    KajI solved with "\r\n"Did you read the other replies? They are correct when they say that you shouldn't use StringTokenizer.
    Kaj

  • String with multiple lines

    hi
    i have a string with multiple lines inside it eg.
    hello this is
    my string with
    mutiple lines inside it
    how could i get it to print out line by line
    iv used "\n" so it detects the new lines but it doesnt seem to work
    this is my following code that doesnt seem to detect the newline
    if(multiString.equals("\n")){
    }

    nicchick wrote:
    i have a string with multiple lines inside it eg.
    hello this is
    my string with
    mutiple lines inside itWhere do you have this String? In a file? in a JTextArea of a Swing GUI? Details are important.
    if(multiString.equals("\n")){But the whole string isn't an "\n" so this won't do. Again, much will depend on the current state of the String. You may need to split it based on the current line separator.

  • HT1430 The screen on my Itouch is erratic with white lines running up and down.  I tried restoring it and holding down on/off button and menu button for 10 seconds about 5 times.  Any ideas on if this can be fixed or am I out of an I touch.  Thank you.

    I need help with my Itouch Screen.  It's running erratic with white line running up and down.  Tried restoring and resetting but nothing works.  Any ideas?  I don't know how this happened.  Might have rubbed a smudge off screen while it was on.  Would this have broken it?  Can it be fixed?  Thanks, Arlene

    - Restore to factory settings/new iOS device.                       
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
      Apple Retail Store - Genius Bar                                                              
    Apple will exchange your iPod for a refurbished one for $99 fr a 16 GB 4G. They do not fix yours.
      Apple - iPod Repair price

  • What is the diffrence between package javax.sql and java.sql

    Is javax designed for J2EE?
    And when to use package javax?

    Hi,
    What is the diffrence between package javax.sql and java.sql?The JDBC 2.0 & above API is comprised of two packages:
    1.The java.sql package and
    2.The javax.sql package.
    java.sql provides features mostly related to client
    side database functionalities where as the javax.sql
    package, which adds server-side capabilities.
    You automatically get both packages when you download the JavaTM 2 Platform, Standard Edition, Version 1.4 (J2SETM) or the JavaTM 2, Platform Enterprise Edition, Version 1.3 (J2EETM).
    For further information on this please visit our website at http://java.sun.com/j2se/1.3/docs/guide/jdbc/index.html
    Hope this helps.
    Good Luck.
    Gayam.Srinivasa Reddy
    Developer Technical Support
    Sun Micro Systems
    http://www.sun.com/developers/support/

  • My Imac is showing gray screen with red line when booting and restarts again

    My Imac is showing gray screen with red line when booting and restart again, I can load it in windows 7 safe mode with red lines across the display, pls help

    The graphic card is damaged. You can't do anything more than taking your computer to an Apple Store or reseller and getting your graphic card replaced.
    Sometimes, when the graphic card is damaged, operating systems can't start. That's caused because the drivers that make the graphic card work detect an error, telling the operating system that the graphic card is unusable, so the operating system can't start and it restarts. However, you can start in safe mode because operating systems use a basic driver in this startup mode

  • Where are my books!? Sync-ed iTunes 10.6.3.25 on Win7 with new iPad3 WiFi/3G and iTunes shows (on my PC) that I have 590 "ebooks" (PDF's

    Not to repaet myself, but... where are my ebooks?
    I sync-ed iTunes 10.6.3.25 on Win7 with new iPad3 WiFi/3G and iTunes shows (on my PC) that I have 590 "ebooks" (PDF's & a few epub's) on my iPad, but for the life of me I can't seem to get to them on the iPad3 itself. If I open iTunes on the iPad3 it only shows a bland grey screen with a link to the "iTunes Stores Terms and Conditions…"? And my iBooks is empty, so is Acrobat Reader which I installed?
    What gives? Gulp… help!?

    That is troubling! 
    I downloaded the Kindle app on my iPad1 tonight, logged into my Amazon.com account and was able to download the books I had bought on my Kindle to my iPad!  I am a VERY HAPPY CAMPER!

  • When I take my phone off charge in the morning I get an info box on the front which has the sound trumpet icon with a line through it and the word Mute.  The only way to get rid of it is to reboot the phone any ideas as to how I can stop this happening?

    When I take my phone off charge in the morning I get an info box on the front which has the sound trumpet icon with a line through it and the word Mute.  The only way to get rid of it is to reboot the phone any ideas as to how I can stop this happening?

    Hello cor-el, thanks for your reply. I changed my settings for downloads to desktop and it has appeared on there. When I double click I am asked which program I want to open file. I click firefox and another box "opening install" says I have chosen to open the file which is an application and do I want to save it. This is the only real option so I press save file. I get a box saying this is an executable file which may contain viruses - do you want to run. I press ok and the final box showing C drive file name and desktop appears stating application not found.
    This happens the same whenever I try to install.
    To my untrained eye the application is not being recognised as an application and I cannot work out how to get it to do that.
    My plugin is still showing as out of date.
    Is there anything you could suggest. Thanks for your time.

  • Went to upgrade and says OS too old. I went back to older version of foxfire. Now I have a circle with a line through it and when I try to open it I get,You cannot open the application "Firefox" because it is not supported on this architecture.

    I have PowerBook G4, running 10.5.8. Went to upgrade and says OS too old. I went back to older version of foxfire. Now I have a circle with a line through it and when I try to open it I get,You cannot open the application “Firefox” because it is not supported on this architecture. Thanks for the help.

    Firefox 3.6.x is the last available from Mozilla for PPC Macs. <br />
    http://www.mozilla.com/en-US/firefox/all-older.html
    For older Macs that aren't supported in Firefox 4+ versions, try TenFourFox for PowerPC's running Mac 10.4.11 & 10.5.8 . <br />
    http://www.floodgap.com/software/tenfourfox/<br />
    http://tenfourfox.blogspot.com/ <br />
    https://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported

  • I recently updated my iPhone 5 with new ios 6.1 and i realize that my 3g is gone can u plz help me how to turn it back?

    i recently updated my iPhone 5 with new ios 6.1 and i realize that my 3g is gone can u plz help me how to turn it back?

    im using wifi, but before setting it was like ---> General--->Cellular---->Cellular Data on/off & 3g on/off. but now i cannot find 3g on/off its gone

  • My Iphone updated today with new IOS 6.1 and while doing that it has sync my phone number with my wife number in the same cloud that we have hence we receive each others SMS when we message each other. Anyone have idea how can I fix this issue in settings

    My Iphone5 updated today with new iOS 6.1 and while doing that it has sync my phone number with my wife number in the same icloud due to which we receive each others SMS when we message each other. Anyone have idea how can I fix this issue in settings etc
    Thank you

    My Iphone5 updated today with new iOS 6.1 and while doing that it has sync my phone number with my wife number in the same icloud due to which we receive each others SMS when we message each other. Anyone have idea how can I fix this issue in settings etc
    Thank you

  • Grey screen no apple followed by blue screen with vertical lines. Graphics and logic board replaced 6 months ago. What to do? I held down shift, it gets HOT HOT and makes noises. (for safety mode) followed by a blank grey screen and blue screen

    grey screen no apple followed by blue screen with vertical lines. Graphics and logic board replaced <6 months ago. What to do? I held down shift, it gets HOT HOT and makes noises. (for safety mode) followed by a blank grey screen and blue screen. Then tried the other way (sorry, I think  it's command alt delete? I don't remember) and it turned from grey (no apple symbol) to blue blank. Then third time, grey followed by blue with vertical lines, not blocky clear lines that you can see if you are close to it.
    Thanks for any help!

    You have to take the computer to the Apple store to have it checked out.
    Genius Bar reservation
    http://www.apple.com/retail/geniusbar/
    Best.

  • Problem with new-line-character and java.io.LineNumberReader under AIX

    Hi folks,
    I got the following problem: I wrote a little parser that reads in a plain-text, tabulator-separated, line-formatted logfile (and later on safes the data to a 2-dimensional Vector). This logfile was originally generated by an AIX ksh script, however, I copied it on my Windows machine to work with it (for I'm using a Java editor that runs under Win Systems).
    For any reason, Windows, and what is worse Java too, seems not to recognize correctly the new-line character (in the API it is written that this should be a newline '\n' or a carriage-return '\r' or one followed by the other) that marks the end of a line in the logfile.
    Also, when I'm opening the logfile with the "Notepad"-editor, this special character does not seem to be recognized, every line is inserted right after the other.
    On the other side, when I open the logfile with the built-in editor in the CMD-Shell ("Dos-shell"), the newline chars seem to be recognized correctly.
    But when start my parser on the AIX-machine the newline does not seem to be recognized correctly again.
    I tried to read in the logfile with MS-Excel and safe it as a plain-text, tabulator-separated, line-formatted logfile again, with such files my parser works fine both on the AIX as it does on Windows.
    Any ideas? Anybody got over the same problem already?
    Greetz FK

    Under windows, text files' lines are usually delimited by \r\n,
    under Unix/Linux/AIX etc. \n
    and under Mac \r.
    I recommend to use the following editors, which are capable to handle files with Unix and Windows-styled line-delimiters or convert between these types:
    Programmer's File Editor (PFE; available on Windows)
    The Nirvana Editor (http://www.nedit.org/; available on Unix, MAcOS, Windows)
    (BTW good old vim can handle that too. Transferring text files to windows in order to edit them, even using Excel for this purpose means your being a UNIX newbie, (I mean no offense by writing this) so vim is probably beyond your reach for the moment.)
    Java normally assumes the platform's line delimiters where it is running, so if you transferred the file from Unix to Windows might be distrurbing.

  • I have moved my itunes to a  new computer and now my ipod will lnot sync with new line up

    i have moved mu itunes to a new computer and my ipod will not sync with new music.

    If you are using automatic syncing, you may need to set up the iPod's Music tab in iTunes.
    Select the iPod in iTunes.  There is a row of "tabs" (starting with Summary).  Select Music there.  This is the Music tab, where you tell iTunes how to sync the iPod with songs.  Sync Music is checkmarked for automatic syncing.
    If your entire iTunes music library can fit on the nano, you can choose to sync Entire music library.  Otherwise, you can choose to sync Selected playlists, artists, albums, and genres.  Then, create your selection of songs below.  For example, if you want to keep it simple, create a new playlist in iTunes.  Put ALL songs you want on the iPod on that playlist, including songs from the newly added music.  Back on the Music tab, find and checkmark that new playlist under Playlists.
    When you click Apply, your selection of songs on the Music tab syncs to the iPod, replacing its current content.  Going forward, any changes that are related to the Music tab settings sync automatically when you connect the iPod, or when you click Sync.  So, if there is a playlist with your "iPod songs," you can just update that playlist (add and remove songs) whenever you want; iTunes updates the iPod with the same changes at the next opportunity.

Maybe you are looking for

  • Validation:  Field status of G/L account

    Problem:  When posting non-goods receipt invoices in MIRO, G/L account and acct assignment object are proposed by purchase order, but they can be overwritten by users with no validation, often resulting in incorrect posting.  Such validation controls

  • How to allow user to enter a string including one quotation mark

    I'm not sure anyone here has talked it before. I'm quite confused, and hope someone could help me. I have a SQL script which has a field for user entering some comments in command-line. Whenever I tried to enter something like " it's not bad" in a st

  • Help with aspx files

    This is not a Dreamweaver  problem but I fugured someone on thi site would have the solution. Its been driving me crazy for too long and just want to get the solution. When click on links on two sites that are aspx dirven the link attempts to dowload

  • Lack of options?

    I am in charge of a Student Council project at the school where I teach (Annville-Cleona High School, Annville, PA). This project is an end of the year slide show. I would like to use iDVD but it has several features that our current slide show in Pp

  • Errors in creating web services in sap

    I am getting below mentioned errors 1.     While testing existing web service http://blade05.wipro.com:8000/sap/bc/srt/rfc/sap/SRT_TESTS_FB_PAR_TEST02_WS?sap-client=100&wsdl=1.1 Network Error (dns_unresolved_hostname) Your requested host "blade05.wip