• 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

Displaying half sting only from database

 
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This is the code with which i am retrieving records and displaying it on page.
At first occuring of value[0] its showing ,line 29, "Anisha Singh"(inserted in databse)
but at second place, incide textbox its showing only, line 45 , "Anisha".
Its not showing complete string stored.
Please help me to solve it.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's because the code generates bad HTML. Attribute values need to be enclosed by quotes, other wise you'll run into trouble if they contain special characters or spaces (as in your example). If you take a look at the generated HTML you will see that the output is exactly what it should be according to the Java code - it's just not proper HTML, and thus does not behave in the browser like you expected it to.
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is your informal use of HTML. Attribute values should be enclosed in quotes so your line
is not strictly valid syntax and should be

Note the extra quotes.

:-) Slow again !
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know JSP .. so the option i left with to generate HTML code within the servlet.
It will really very help if you can guide me to right direction.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Richard ..now its working as required.
"Slow again !"???
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Singh Anisha wrote:
"Slow again !"???


He means that Ulf beat him to the punch.

You should be learning JSP. Building up HTML in strings in a servlet is a horrible way to do things.
 
Singh Anisha
Ranch Hand
Posts: 100
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree.
Very soon i'll learn JSP.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be sure that you learn modern JSP. If you see Java code in a JSP, that's old technology that's been obsolete for 11 years. Be sure to learn JSP with the JSTL and EL.

You might also want to read this article to help get started.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic