• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How i store enter key and space in MySql database

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
I am taking values from user in textfield of jsp, user enter values with spaces and enter keys (in particular format). I want to save that values as it is in table.

I created table advertise, having column adid-INT and adcontent-TEXT,
user enter data in adcontent field from GUI(which is in jsp) following format.

" We have openings... for
-Developer
-Marketing
-Accounts"
latter i store this values in table column adcontent.

But when i retrieve values table and display them, it will look like,
" We have openings... for -Developer -Marketing -Accounts"
In one row.

so its possible to store and retrieve above statement as it is enter by user in mysql database tables.
 
Ranch Hand
Posts: 157
1
Android MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vinod, you can save \n in mysql db for every enter pressed, similarly you can keep other signs which which give you back the same indentation in java after retrieval.
 
Vinod suryawanshi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replay harshvardhan ojha,
but i am not entering value in database, user enter value in form(which is part of GUI). which i want to save into database as it is. from your answer i got one clue, that if i take value from user and add necessary '\n' and ' ' according to user enter values & Then i enter them into database. May be this will work, i have to check.
But still if you have any other easy solution then please reply....
And one more time, thankss
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you say you "display" those things, you mean you display them in HTML, right?

And perhaps you didn't remember that HTML normally converts blocks of white-space to a single space character? So for example a series of three space characters would be displayed as just one space, and a new-line character (what you called "enter key") is also displayed as just one space.

In other words your problem has nothing to do with the database and everything to do with how HTML works.
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic